Subject: 'loop' without 'do'
Posted By: drea Post Date: 4/7/2006 1:16:56 PM
Hi,

I am trying to put images side by side on a webpage. However, with my code I get a 'loop' without 'do'  error. What do I need to add to this code so that my images appear next to each other? It is for this page: http://scarscare.org/lookatusnow.asp



<!--#include virtual="/templates/header.asp" -->
<!--#include virtual="/db/dsn.asp"-->
<%

 SQL = "SELECT * from lookatusnow ORDER BY [date] DESC"
 Set objRS = objConn.Execute(SQL)
 
%>
                    <table width="600" height="100%" border="0" align="center" cellpadding="0" cellspacing="10">
                      <tr>
                        <td colspan="2" align="left" valign="top"><p align="left"><span class="redHeading16">Look At Us Now! </span><span class="bodyblack1"><br>
                            </span></p></td>
                      </tr>
                      <tr align="left">
                        <td colspan="2" valign="top"><p>Click the images to see how they are doing now! </p>
      
      <% DO WHILE NOT objRS.EOF %>
                          <p><strong>
        <% IF objRS("doc") <> "" THEN %><a href="<%=objRS("doc")%>" target="_blank"><% END IF %><%=objRS("title")%> (<%=objRS("date")%>) <br>
        <img src="<%=objRS("image")%>" width="250" height="250" border="0"><% IF objRS("doc") <> "" THEN %></a><% END IF %>
                                </strong></p>
      
      <% objRS.MoveNext %>
      <% LOOP %>
        
        </td>
                      </tr>


         
      
                    </table>
                  <!--#include virtual="/templates/footer.asp" -->


Thanks in advance for any help that you can provide!

Andrea
Reply By: mat41 Reply Date: 4/9/2006 7:09:32 PM
try this"
<!--#include virtual="/templates/header.asp" -->
<!--#include virtual="/db/dsn.asp"-->

<%
 SQL = "SELECT * from lookatusnow ORDER BY [date] DESC"
 Set objRS = objConn.Execute(SQL)
 %>
<table width="600" height="100%" border="0" align="center" cellpadding="0" cellspacing="10">
<tr>
 <td colspan="2" align="left" valign="top"><p align="left"><span class="redHeading16">Look At Us Now! </span><span class="bodyblack1"><br></span></p></td>
</tr>
<tr align="left">
 <td colspan="2" valign="top"><p>Click the images to see how they are doing now! </p>
<%  if not objrs.Eof then
       DO WHILE NOT objRS.EOF %>
          <p><strong>
<%        IF objRS("doc") <> "" THEN %>
             <a href="<%=objRS("doc")%>" target="_blank">
<%        END IF %>
          <%=response.wriye objRS("title")%> (<%=objRS("date")%>) <br>
          <img src="<%=objRS("image")%>" width="250" height="250" border="0"><% IF objRS("doc") <> "" THEN %></a><% END IF %></strong></p>
<%        objRS.MoveNext %>
<%     LOOP
    else
       response.write "<i>your recordset is emptu"</i>
    end if%>
 </td>
</tr>
</table>
<!--#include virtual="/templates/footer.asp" -->

Wind is your friend
Matt
Reply By: drea Reply Date: 4/10/2006 11:21:24 AM
Thanks for your help Matt,

I tried this but,I got an HTTP error - the site can not be displayed.
 
Any thoughts?

Andrea
Reply By: mat41 Reply Date: 4/10/2006 6:22:24 PM
An HTTP error is not very hrlpful. Turn off friendly HTTP errors:
tools/intenet Options/advanced/ [un tick the box to showw friendly HTTP errors]/Apply and then close the browser, open a new browser, hit the page, now what does it say?

Post the exact error syntax.  Including line number and point out this line in your code



Wind is your friend
Matt
Reply By: drea Reply Date: 4/13/2006 3:09:51 PM
Thank you, you have been so helpful. Here is the error:

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/lookatusnow.asp, line 20

Response.Write(response.wriye objRS("title"))
------------------------------^


Reply By: mat41 Reply Date: 4/14/2006 10:57:15 PM
change:
Response.Write(response.wriye objRS("title"))
to:
Response.Write(response.write objRS("title")

Problem = typo in the word write and on to many ) as the error told you.  FYI for every one of ( you need a )


Wind is your friend
Matt
Reply By: mat41 Reply Date: 4/14/2006 10:59:54 PM
Also I have noticed:

<%=response.wriye objRS("title")%>

will generate an error.  It should be:
<% response.write objRS("title")%>
OR
<%= objRS("title")%>

FYI the <%= is short hand for <% response.write

Wind is your friend
Matt

Go to topic 42905

Return to index page 313
Return to index page 312
Return to index page 311
Return to index page 310
Return to index page 309
Return to index page 308
Return to index page 307
Return to index page 306
Return to index page 305
Return to index page 304