Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Table Formatting 1

Status
Not open for further replies.

08091979

Programmer
Joined
Dec 18, 2003
Messages
5
Location
GB
I ahve a query that return 15 records. How can i format a html table to only display 3 records per row?
 
I would suggest initialising a variable at 0, incrementing it by +1 each time you write a record using the <TD> tag.

Then check it after writing each record and, whenever it reaches a value of 3, create a new table row using the <TR> tag and reset your variable to 0.
 
try something like this...
Code:
<TABLE cols="3">
<%
intCount = 1

While NOT objRS.EOF
  If intCount = 1 Then
    Response.Write "<TR>" & vbcrlf
  End If

  Response.Write "<TD>" & objRS("YourResultsField") & "</TD>"

  If intCount = 3 Then
    Response.Write "</TR>" & vbcrlf
    intCount = 0
  End If

  intCount = intCount + 1
  objRS.MoveNext
Wend
%>
</TABLE>

Tony
________________________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top