944,055 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 7198
  • ASP RSS
Apr 7th, 2005
0

horizontal loop from database records

Expand Post »
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: )
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Apr 9th, 2005
0

Re: horizontal loop from database records

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
Reputation Points: 25
Solved Threads: 7
Junior Poster
Drew is offline Offline
166 posts
since Apr 2004
Apr 11th, 2005
0

Re: horizontal loop from database records

basicaly what i want is:
1 2
3 4
5 6
7 8 etc
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Apr 12th, 2005
0

Re: horizontal loop from database records

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

ASP Syntax (Toggle Plain Text)
  1. <table width="300" border="1" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <% Dim nextline, todisplay, endof
  4. todisplay = 2
  5. nextline = 0
  6. endof = 0
  7. %>
  8. <% do while endof <> (Recordset1_total) AND (NOT Recordset1.EOF)%>
  9. <% endof = endof + 1 %>
  10. <% If nextline = todisplay Then %>
  11. <% nextline = 0 %>
  12. </tr>
  13. <tr>
  14. <% End If %>
  15. <% nextline = nextline + 1 %>
  16. <td><%=(Recordset1.Fields.Item("ID").Value)%></td>
  17. <% Recordset1.MoveNext() %>
  18. <% loop %>
  19. </tr>
  20. </table>
The "Recordset1_total" is the amount of total records in the recordset
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Nov 24th, 2009
0

thank you

thank you for this reference
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sutil is offline Offline
1 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: IIS URL decoding
Next Thread in ASP Forum Timeline: Active Directory- extracting groups





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC