Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 30th, 2005, 11:19 AM   #1
mann95
Newbie
 
Join Date: Dec 2005
Posts: 1
Rep Power: 0 mann95 is on a distinguished road
Help needed with viewing shopping cart

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
mann95 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC