forgodsake8
04-12-2005, 11:21 AM
Hi,
I'm trying to set up a staff page, and Ive got it to work outputting all the photos with staff details such Name, Dept and Extension Num.
I wanted it to I could have three pictures per row horizontally across the page.
The only way I could get it to work like this was using the following code:
<table width="90%" align="left">
<%
dim ctr
ctr=1
DO WHILE NOT temp.EOF
IF ctr = 1 THEN
response.write "<tr>"
END IF
%>
<td align=center>
<img src="/Pictures/<% Response.write temp("Picture")%>" width=200 height=150><br>
<% Response.write temp("Name")%> <br> <% Response.write temp("Job_Title")%><br>
<% Response.write temp("Department")%><br><% Response.write temp("Ext")%>
</td>
<%
IF ctr = 3 THEN
reponse.write "</tr>"
ctr = 1
ELSE
ctr = ctr + 1
END IF
temp.MoveNext
Loop
%>
</table>
The problem I get though is if say I have 5 photos...it loops through the first three fine...but when it loops through the next three....because there are only five photos and not six...it coming up with a not at EOF error....because there's nothing to fill the last record:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/accounts.asp, line 0
I know this is because its running through the output of the photographs and hitting the last record of photo output and there's nothing to output...but I can't see any other way of coding it so it outputs the page with three photos per row.
Any ideas?!!?
Thanks.
I'm trying to set up a staff page, and Ive got it to work outputting all the photos with staff details such Name, Dept and Extension Num.
I wanted it to I could have three pictures per row horizontally across the page.
The only way I could get it to work like this was using the following code:
<table width="90%" align="left">
<%
dim ctr
ctr=1
DO WHILE NOT temp.EOF
IF ctr = 1 THEN
response.write "<tr>"
END IF
%>
<td align=center>
<img src="/Pictures/<% Response.write temp("Picture")%>" width=200 height=150><br>
<% Response.write temp("Name")%> <br> <% Response.write temp("Job_Title")%><br>
<% Response.write temp("Department")%><br><% Response.write temp("Ext")%>
</td>
<%
IF ctr = 3 THEN
reponse.write "</tr>"
ctr = 1
ELSE
ctr = ctr + 1
END IF
temp.MoveNext
Loop
%>
</table>
The problem I get though is if say I have 5 photos...it loops through the first three fine...but when it loops through the next three....because there are only five photos and not six...it coming up with a not at EOF error....because there's nothing to fill the last record:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/accounts.asp, line 0
I know this is because its running through the output of the photographs and hitting the last record of photo output and there's nothing to output...but I can't see any other way of coding it so it outputs the page with three photos per row.
Any ideas?!!?
Thanks.