looping problem

B

Billy Barth

I am trying to loop through my database to display a picture. That is
no problem. Where I hit a snag is this. I only want three pictures
then break to a new row and three more, etc. Any ideas?
What this does is display one record. Any Help would be appreciated
Below is my code.

<%
strSQL="SELECT DISTINCT Kids.kids_Id AS Kids, kids_pics.kids_ID AS
kids_pics_kids_ID,pic_name,first_Name,kids_Desc,kids_Age FROM Kids
INNER JOIN kids_pics ON Kids.kids_Id = kids_pics.kids_ID "
Set rsk = CreateObject("ADODB.Recordset")
rsk.Open strSQL, con, adOpenStatic, adLockReadOnly
%>

<h1>Waiting Children</h1>

<%
count=count+1
if rsk.eof then error
if not rsk.eof and count>=3 then
count=0%>error
<%else%>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="81"><img src="images/kids_photos/<
%=rsk("pic_name")%>" alt="Featured Child" /></td>
</tr>
<tr>
<td align="center" width="81"><%=rsk("first_Name")%></td>
</tr></table>
<%end if%>
 
B

Billy Barth

Personally I avoid mixing html and .asp too much. , I find it confusing and
prefer to use response.write. Anyway, I don't see a loop in your code
anywhere. Do something like

count=0
do while not rsk.eof
count=count+1
if count = 3 then
count =0
'insert a line break or whatever
end if
'write out your stuff
loop

rsk.close

John Blessing
(e-mail address removed)://www.LbeHelpdesk.com- Help Desk software priced to suit all
businesseshttp://www.room-booking-software.com- Schedule rooms & equipment bookings
for your meeting/class over the web.http://www.lbetoolbox.com- Remove Duplicates from MS Outlook- Hide quoted text -

- Show quoted text -

Worked. thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top