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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

column span 1

Status
Not open for further replies.

Bamarama

Programmer
Dec 29, 2006
49
US
column span

Probably answered here before, but I couldn't find it.

I want to obtain rows of information from my DB. I want the results to span 5 columns then start on the next row.

i used to know how to do this, but it has been a long time.

so let's say all it is is a list of names. i want it to go 5 across and then start on the next row as shown

<%
do while not info.eof
%>

<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
</tr>
<% info.movenext
loop%>


any help would be appreciated
 
if the recordset "info" has the 5 fields you want in the order you want:

Code:
do while not info.eof
 response.write "<tr>"
 for i = 0 to 4
  response.write "<td>"& info(i) & "</td>"
 next
 response.write "</tr>"
 info.movenext
loop
 
rereading it, you have 10 fields?
Code:
do while not info.eof 
 response.write "<tr>" 
 for i = 0 to 4  
  response.write "<td>" & info(i) & "</td>" 
 next 
 response.write "</tr>" 
 response.write "<tr>" 
 for i = 5 to 9
  response.write "<td>" & info(i) & "</td>" 
 next 
 response.write "</tr>" 

 info.movenext
loop
[code]
 
no not 10 fields. let me try to clarify.

say each name would have a number so columns would be

aName and aNumber now there would be many rows, but just the 2 fields (columns)

what i would like to display is

name name name name name
number number number number number

then start with the next record on the next row. does that make more sense?
 
Code:
i = 0
do while not info.eof  

' New row?
if i = 0 then
 response.write "<tr>"  
end if

response.write "<td>" & info("name") & "<br>"
               info("number") & "</td>"  
i = i + 1
' max cols?
if i = 5 then
 'reset
 i = 0
 response.write "</tr>"
end if

info.movenext
loop

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top