p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   'loop' without 'do' (http://p2p.wrox.com/showthread.php?t=40963)

drea April 7th, 2006 01:16 PM

'loop' without 'do'
 
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





<%

 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>



Thanks in advance for any help that you can provide!

Andrea

mat41 April 9th, 2006 07:09 PM

try this"



<%
 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>


Wind is your friend
Matt

drea April 10th, 2006 11:21 AM

Thanks for your help Matt,

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

Any thoughts?

Andrea

mat41 April 10th, 2006 06:22 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

drea April 13th, 2006 03:09 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"))
------------------------------^



mat41 April 14th, 2006 10:57 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

mat41 April 14th, 2006 10:59 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


All times are GMT -4. The time now is 02:30 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.