Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 7th, 2006, 01:16 PM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default '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
  #2 (permalink)  
Old April 9th, 2006, 07:09 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
  #3 (permalink)  
Old April 10th, 2006, 11:21 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help Matt,

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

Any thoughts?

Andrea
  #4 (permalink)  
Old April 10th, 2006, 06:22 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
  #5 (permalink)  
Old April 13th, 2006, 03:09 PM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"))
------------------------------^


  #6 (permalink)  
Old April 14th, 2006, 10:57 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
  #7 (permalink)  
Old April 14th, 2006, 10:59 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with for-each loop athanatos XSLT 0 April 10th, 2006 07:20 PM
Do Until loop with IF crmpicco Classic ASP Databases 2 June 15th, 2005 05:35 PM
For....Loop kliu9 Excel VBA 5 February 10th, 2005 06:43 AM
Do Loop junemo Beginning PHP 8 July 28th, 2004 02:58 AM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





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