Hi

I have a site that lists a companies products (lots). It has a database table containing these records. I want to loop the records to show 2 accross and the rest down (2 records per row by unlimited rows). it is possible because i made a mistake on an ordinary loop and it did this but i lost my mistake and can't remember what i did.

Help is appreciated ( :eek: I got a deadline :cry: )

Recommended Answers

All 4 Replies

So are you trying to loop through the records so its 2 records a single row? I really dont understand what you are trying to do... :s

basicaly what i want is:
1 2
3 4
5 6
7 8 etc

Ok so at about 12 (very late) I came up with a solution

<table width="300" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <% Dim nextline, todisplay, endof
todisplay = 2
nextline = 0 
endof = 0
%>
    <% do while endof <> (Recordset1_total) AND (NOT Recordset1.EOF)%>
    <% endof = endof + 1 %>
    <% If nextline = todisplay Then %>
    <% nextline = 0 %>
  </tr>
  <tr>
    <% End If %>
    <% nextline = nextline + 1 %>
    <td><%=(Recordset1.Fields.Item("ID").Value)%></td>
    <%  Recordset1.MoveNext() %>
    <% loop %>
  </tr>
</table>

The "Recordset1_total" is the amount of total records in the recordset

thank you for this reference

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.