| | |
horizontal loop from database records
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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: )
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: )
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
Ok so at about 12 (very late) I came up with a solution
The "Recordset1_total" is the amount of total records in the recordset
ASP Syntax (Toggle Plain Text)
<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>
![]() |
Similar Threads
- FlexGrid issue and error "Invalid Row value".... (Visual Basic 4 / 5 / 6)
- how to insert data from dataset into database (VB.NET)
- Access Database file conversion (Database Design)
- access database search and display (Visual Basic 4 / 5 / 6)
- fsockopen Jumping out of Loop (PHP)
- Querying database records (Visual Basic 4 / 5 / 6)
Other Threads in the ASP Forum
- Previous Thread: SQL Update does not work?
- Next Thread: Active Directory- extracting groups
| Thread Tools | Search this Thread |
Tag cloud for ASP
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection calendar changeable connection current database databaseconnection diagnostics dreamweaver excel fso html iis microsoft msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption server single specfic sqlserver sqlserverconnection toolkit web webserver windows7





