PDA

View Full Version : loop only 9 times.


Baleric
05-19-2006, 10:28 AM
hey guys, ive been currently using dreamweaver for my recordsets up till today and was wondering how to doa repear region that links only 9 times,
when i use the code the dreamweaver uses its completely stuff up and shows the 1st record 9 times,

here is my code.

<table width="100%" cellpadding="0" cellspacing="0">
<%
DO WHILE NOT rSitems.EOF
Response.Write("<tr>")

FOR i = 1 TO 3
%>
<td align="center" valign="top" class="BorderTD" div><%
IF rSitems.EOF THEN
%>

<%
ELSE
%>
<form action="buynow.asp?id=<%= rsitems("id") %>" method="post" name="Product" id="Product">
<br>
<img src="../Images/spacer.gif" alt="Spacer" width="150" height="1"><br>
<% If rSitems("Thumbnail") <> "" Then %>
<img src="Productimages/<%=(rSitems.Fields.Item("Thumbnail").Value)%>" alt="Thumbnail" name="Image" width="75" height="75">
<% Else %>
<img src="../Images/noimg.gif" alt="Blank" width="75" height="75">
<% End If %>






<br>
<br>


<a href="prodinfo.asp?id=<%=(rSitems.Fields.Item("ID").Value)%>" class="style11">

<%=(rSitems.Fields.Item("Product").Value)%><br>
</a><span class="style16"><%=(rSitems.Fields.Item("ProductInfo").Value)%></span> <br>
<span class="Prices">Our Price : $<%=(rSitems.Fields.Item("YourPrice").Value)%></span><br>
<span class="style13">RRP:</span> <span class="RRPtext">$<%=(rSitems.Fields.Item("RRP").Value)%></span><span class="style13"><br>
<br>
<span class="style35">Stock : Yes</span> </span><br>
<span class="style13">Ammount</span>
<input name="Ammount" type="text" id="Ammount" value="1" size="2" maxlength="2">
<br>

<input name="submit" type="image" src= "../images/btnbuynow.gif" onMouseOver="this.src='../images/btnbuynowover.gif'" onMouseOut="this.src='../images/btnbuynow.gif'" width="100" height="34">
</form>
<form name="form1" method="post" action="">
<a href="prodinfo.asp?id=<%=(rSitems.Fields.Item("ID").Value)%>" class="Prices">More Information</a>
</form>
<%
rSitems.MoveNext
END IF
%> </td>
<%
NEXT

Response.Write("</tr>")
LOOP %>


the code lists the items 3 times across but i would also like it 3 times down,
and also be able to move to the next page, dreamweaver is so easy to do it with but it has its limitations...

please help, or give me a link to help.

cheers guys,

baleric

ghell
05-20-2006, 10:31 PM
eugh dreamweaver as you can see makes for disgusting code. If i were you i would just write it all by hand in a nice editor like www.crimsoneditor.com

you will just be looping through and missing a movenext anyway or something though. i gave up trying to read the messy code so i can't give specifics.

also use rs.GetRows() then close the recordset and connection and set their objects to = Nothing and use the 2d array that getrows gave you. it will increase performance. If you just wish to get the top 3 records from a database or whatever use TOP 3 in the sql instead of getting it all thetn only using 3.. that kinda thing will help performance a lot.