Hi guys
I am trying to add a shopping cart to my website, so far I have managed to create a page which will insert items into a table called cart within my database. However I am getting an error message with the page I have created to allow users to view items within their cart. The error I am getting is:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/n0253071/viewcart.asp, line 14
sql="SELECT * FROM Cart, Books WHERE Cart.BookID = Books.BookID AND Cart.user_id LIKE '" & UserNo & "'";
---------------------------------------------------------------------------------------------------------------------------------------------------------^
At the moment all I want the cart to display is the user_id from the cart table where it matches that stored in cookie and where BookID is the same in both the books table and cart table. I am unsure if I constructed the join correctly.
My code for this page is:
<%
set UserNo = Request.Cookies("Name2")
response.write(UserNo)
%>
<%
set BookNo = Request.QueryString("BookID")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("\n0253071\db\products.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT Books.BookID FROM Books, Cart WHERE (Books.BookID = Cart.BookID) AND (Cart.user_id='" & UserNo & "')"
rs.Open sql,conn
response.write("<p><font face=verdana size=2>" & rs.fields("BookID") & "</font></p>")
rs.close
conn.close
%>
Any help is much appreciated.
Thanks
CM