horizontal loop from database records

Reply

Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

horizontal loop from database records

 
0
  #1
Apr 7th, 2005
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: )
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 167
Reputation: Drew is an unknown quantity at this point 
Solved Threads: 7
Drew's Avatar
Drew Drew is offline Offline
Junior Poster

Re: horizontal loop from database records

 
0
  #2
Apr 9th, 2005
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
Drew Gauderman
ASP / MSSQL Coder
http://www.iportalx.net - My ASP Portal
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: horizontal loop from database records

 
0
  #3
Apr 11th, 2005
basicaly what i want is:
1 2
3 4
5 6
7 8 etc
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: horizontal loop from database records

 
0
  #4
Apr 12th, 2005
Ok so at about 12 (very late) I came up with a solution

  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
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 1
Reputation: sutil is an unknown quantity at this point 
Solved Threads: 0
sutil sutil is offline Offline
Newbie Poster

thank you

 
0
  #5
22 Days Ago
thank you for this reference
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC