|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Displaying records in a table
This is the problem: I want to display the some records I have gathered in a recordset using a SQL query. I want the table to have 3 cells per row (easy so far). If the recordset happens to contain 15 records, then there are no problems (3 cells x 5 rows). However, if there are 16 or 17 records then the final row does not have 3 cells in it anymore (it has 1 or 2 cells respectively). What I would like to do is if there is only 1 cell in the last row then colspan=3 (Haven't decided what to do if there is 2 cells just yet.) This is brief example of my code: <table> <% cellcount=0 do while cellcount<4 cellcount=cellcount+1 if cellcount=1 then response.write("<tr>") else end if response.write("<td>") response.write(rs("Name")) response.write("</td>") if cellcount=3 then response.write("<tr>") cellcount=0 else end if loop %> </table> I know there is a much simpler solution, I could just create a new table for every row. But I'm keen to see if there is another way. Thanks in advance, Darren Stahlhut |
|||||||||||||||||||||||