do unitl loop 3 per row

# Thread: do unitl loop 3 per row

1. Junior Member
Join Date
Dec 1969
Posts
28

## do unitl loop 3 per row

hi.<BR><BR>i&#039;m trying to loop through and display a recordset, but i would like to show upto 3 recordsets per row and then move to the next &#060;TR&#062;. how do you suggest i do this or where can i find some helpful info.<BR><BR>&#060;table&#062;<BR>&#060;% Do Until RS.EOF %&#062;<BR> &#060;tr&#062;<BR> &#060;td&#062;&#060;%=RS("Desc")%&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%=RS("Desc")%&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%=RS("Desc")%&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR>&#060;% RS.MoveNext<BR>Loop<BR>RS.Close%&#062;<BR>&#060;ta ble&#062;<BR><BR>thanks.<BR>matt

2. Senior Member
Join Date
Dec 1969
Posts
1,212

## me, I'd put the rs into an array....

...but that&#039;s just me. I like arrays.<BR><BR>then you could just do a for loop through the RS rows and in each TR do something like <BR><BR>&#060;%for row = 0 to Ubound(myRows)%&#062;<BR>&#060;tr&#062;&#060;td&#0 62;&#060;%=myArray(row,1)%&#062;&#060;/td&#062;<BR>&#060;td&#062;&#060;%=myArray(row+1,1) %&#062;&#060;/td&#062;<BR>&#060;td&#062;&#060;%=myArray(row+2,1) %&#062;&#060;/td&#062;&#060;/tr&#062;<BR>&#060;%next%&#062;<BR><BR>That&#039;s very much just an idea off the top of my head though. I&#039;ve probably f*cked up horribly somehow, and now I&#039;m gonna get flamed ;-)

3. Senior Member
Join Date
Dec 1969
Posts
1,212

## I HAVE f*cked up lol

ignore that, it&#039;s rubbish. but I do think the basic idea of using arrays instead of an RS is sound...

4. Senior Member
Join Date
Dec 1969
Posts
2,854

## something like

&#060;table&#062;&#060;tr&#062; <BR>&#060;% Dim i : i= 1<BR>Do Until RS.EOF <BR> If i = 1 then %&#062;<BR> &#060;tr&#062;<BR> &#060;%end if%&#062;<BR>&#060;td&#062;&#060;%=RS("Desc")%&#06 2;&#060;/td&#062; <BR>&#060;%If i = 3 then %&#062;<BR> &#060;/tr&#062;<BR>&#060;%i=1<BR>else<BR>i = i+1<BR>end if%&#062;<BR>RS.MoveNext <BR>Loop <BR>RS.Close%&#062; <BR> &#060;/tr&#062;&#060;table&#062; <BR><BR><BR>HTH.<BR>D.

5. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Hmmmm

&#060;table&#062;&#060;tr&#062; <BR>&#060;% Dim i : i= 1<BR>Do Until RS.EOF <BR>If i = 1 then %&#062;<BR>&#060;tr&#062;<BR><BR>wont this put two &#060;tr&#062;s to start with?<BR>

6. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Not really

maybe only in terms of speed, otherwise using a rs or an array will be the same<BR><BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
2,854

## RE: Hmmmm

It will Indeed, so check if you are on firstpass with a boolean variable or something.<BR><BR>thanks Ak.<BR><BR>:-) Its late on Friday Arvie, and I wanna go home :-(

8. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Or

dont put the &#060;tr&#062; outside the loop<BR><BR>late Fri?? i wish i was there, it ie early Fri for me :(<BR><BR>

9. Senior Member
Join Date
Dec 1969
Posts
2,854

## heh

good point.<BR><BR>:-)

10. Junior Member
Join Date
Dec 1969
Posts
28

## thanks all... for the help <eop>

.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•