looping problem
am 06.06.2007 21:47:01 von 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
%>
Waiting Children
<%
count=count+1
if rsk.eof then error
if not rsk.eof and count>=3 then
count=0%>error
<%else%>
" alt="Featured Child" /> |
<%=rsk("first_Name")%> |
<%end if%>
Re: looping problem
am 06.06.2007 23:08:09 von John Blessing
"Billy Barth" wrote in message
news:1181159221.837885.142370@i38g2000prf.googlegroups.com.. .
>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
> %>
>
> Waiting Children
>
> <%
> count=count+1
> if rsk.eof then error
> if not rsk.eof and count>=3 then
> count=0%>error
> <%else%>
>
>
> " alt="Featured Child" /> |
>
>
> <%=rsk("first_Name")%> |
>
> <%end if%>
>
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
john.blessing@Lbesoftware.com
http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://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
Re: looping problem
am 07.06.2007 16:33:00 von Billy Barth
On Jun 6, 5:08 pm, "John Blessing"
wrote:
> "Billy Barth" wrote in message
>
> news:1181159221.837885.142370@i38g2000prf.googlegroups.com.. .
>
>
>
>
>
> >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
> > %>
>
> > Waiting Children
>
> > <%
> > count=count+1
> > if rsk.eof then error
> > if not rsk.eof and count>=3 then
> > count=0%>error
> > <%else%>
> >
> >
> > " alt="Featured Child" /> |
> >
> >
> > <%=rsk("first_Name")%> |
> >
> > <%end if%>
>
> 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
> john.bless...@Lbesoftware.comhttp://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.