Wrox Programmer Forums
|
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
 
Old July 15th, 2003, 12:26 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default loop with out do

i have this code (i've already opened the database connection) and i am getting a "loop without do" error. does anybody see what i'm doing wrong?

<%

rs.movefirst
do while not rs.eof
if rs("itemNumber") = "112233" and rs("paymentStatus") = "Completed" then


%>

<td colspan="1" class="description" width="60" height="25" valign="top"><p>Item sold</p></td>
<td class="description" width="160" height="25" valign="top"></td>


<%

rs.movenext
loop

else

%>

<td colspan="1" class="payButtons" width="60" height="25" valign="top">
      <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="business" value="[email protected]">
        <input type="hidden" name="item_name" value="Dragon">
        <input type="hidden" name="item_number" value="112233">
        <input type="hidden" name="amount" value=".01">
        <input type="hidden" name="return" value="http://www.scrapmenagerie.com/somefolder/somefile.asp">
        <input type="hidden" name="cancel_return" value="http://www.scrapmenagerie.com/sorry.asp">
        <input type="hidden" name="no_note" value="1">
        <input type="hidden" name="currency_code" value="USD">
        <input type="image" src="http://www.scrapmenagerie.com/pageImages/buyButton.gif" border="0" align="left" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
        <input type="hidden" name="add" value="1">
      </form>
    </td>
    <td class="payButtons" width="160" height="25" valign="top">
      <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="business" value="[email protected]">
        <input type="image" src="http://www.scrapmenagerie.com/pageImages/viewCartButton.gif" border="0" align="left" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
        <input type="hidden" name="display" value="1">
      </form>
    </td>
<%

end if

%>


 
Old July 15th, 2003, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you either need to put the entire IF..THEN statement inside the LOOP, or put the LOOP entirely inside the IF..Then.

You have the DO..LOOP started,
the IF..THEN started
The DO..LOOP ended,
an ELSE
then an END IF


Chris
 
Old July 15th, 2003, 12:51 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you. isn't my loop already inside my if then statement? would you mind giving me the specific example to fix my code? i appreciate the response.

 
Old July 15th, 2003, 12:54 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry. asked to quickly. fixed the problem. thanks again...






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.