Hi,
Ive got this error coming up on my page, but not quite sure what is expecting?
Here's my code (line 160 is in red):
Ive got this error coming up on my page, but not quite sure what is expecting?
Quote:
| Error Type: Microsoft VBScript compilation (0x800A0400) Expected statement /addCart.asp, line 160 |
Here's my code (line 160 is in red):
Code:
<% ' Get Product ID productID = TRIM( Request( "pid" ) ) ' Add Item to cart IF productID <> "" THEN sqlString = "SELECT cart_id FROM cart " &_ "WHERE cart_userID=" & userID & " " &_ "AND cart_productID=" & productID SET RS = Con.Execute( sqlString ) IF RS.EOF THEN sqlString = "INSERT INTO cart ( " &_ "cart_userID, " &_ "cart_productID, " &_ "cart_quantity " &_ ") VALUES ( " &_ userID & ", " &_ productID & ", 1 )" ELSE sqlString = "UPDATE cart SET " &_ "cart_quantity=cart_quantity+1 " &_ "WHERE cart_id=" & RS( "cart_id" ) END IF RS.Close SET RS = Nothing Con.Execute sqlString END IF ' Update Shopping Cart Quantities IF Request( "updateQ" ) <> "" THEN SET RS = Server.CreateObject( "ADODB.Recordset" ) RS.ActiveConnection = Con RS.CursorType = adOpenDynamic RS.LockType = adLockOptimistic sqlString = "SELECT cart_id, cart_quantity FROM cart " &_ "WHERE cart_userID=" & userID RS.Open sqlString WHILE NOT RS.EOF newQ = TRIM( Request( "pq" & RS( "cart_id" ) ) ) IF newQ = "" OR newQ = "0" THEN RS.Delete ELSE IF isNumeric( newQ ) THEN RS( "cart_quantity" ) = newQ END IF END IF RS.MoveNext WEND RS.Close SET RS = Nothing END IF %> <html> <head><title>Shopping Cart</title></head> <body bgcolor="white"> <center> <font face="Arial" size=3 color="black"> <b><%=username%>'s Shopping Cart:</b> </font> <% ' Get the shopping cart sqlString = "SELECT cart_id, product_name, " &_ "product_price, cart_quantity " &_ "FROM cart, products " &_ "WHERE cart_userID=" & userID & " " &_ "AND cart_productID = product_id " &_ "ORDER BY cart_id DESC" SET RS = Con.Execute( sqlString ) IF RS.EOF THEN %> <font face="Arial" size=3 color="black"> <p><b>You do not have any items in your shopping cart</b> </font> <p> <form action="main.asp"> <input type="submit" value="Continue Shopping"> </form> <% ELSE orderTotal = 0 %> <form method="post" action="cart.asp"> <input name="updateQ" type="hidden" value="1"> <input name="username" type="hidden" value="<%=username%>"> <input name="password" type="hidden" value="<%=password%>"> <table bgcolor="lightyellow" border=1 cellpadding=4 cellspacing=0> <tr bgcolor="lightgreen"> <th><font face="Arial" size=2 color="black">Product</th></font> <th><font face="Arial" size=2 color="black">Price</th></font> <th><font face="Arial" size=2 color="black">Quantity</th></font> </tr> <% ' Set currency to British pounds intLocale = SetLocale(2057) WHILE NOT RS.EOF orderTotal = orderTotal + ( RS( "product_price" ) * RS( "cart_quantity" ) ) %> <tr> <td> <font face="Arial" size=2 color="black"> <%=Server.HTMLEncode( RS( "product_name" ) )%> </font> </td> <td> <font face="Arial" size=2 color="black"> <%=formatCurrency( RS( "product_price" ) )%> </font> </td> <td> <font face="Arial" size=2 color="black"> <input name="pq<%=RS( "cart_id" )%>" type="text" size=4 value="<%=RS( "cart_quantity" )%>"> <input name="pd<%=RS( "cart_id" )%>" type="checkbox" value="1">Delete </font> </td> </tr> <% RS.MoveNext WEND %> <tr bgcolor="#FFFFC6"> <td colspan=2 align=right> <font face="Arial" size=2 color="black"> <b>Order Total:</b> </font> </td> <td> <font face="Arial" size=2 color="black"> <%=formatCurrency( orderTotal )%> </font> </td> </tr> <tr> <td colspan=3> <table border=0> <tr> <td align="right"> <input type="submit" value="Update Cart"> </td> </form> <form method="post" action="checkStock.asp"> <input name="username" type="hidden" value="<%=username%>"> <input name="password" type="hidden" value="<%=password%>"> <td> <input type="submit" value="Checkout"> </td> </form> <form action="main.asp"> <td> <input type="submit" value="Continue Shopping"> </td> </form> </tr> </table> </td> </tr> </table> <% END IF %> </center> </body> </html>
