Re: Shopping Cart Woes!!

From: Date: Tue, 06 Jan 2004 11:27:44 +0000
Subject: Re: Shopping Cart Woes!!
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-22494@lists.php.net to get a copy of this message
Thanks for the replies, much appreciated. I have now managed to get the query to work properly. As Justen suggested I added "WHERE" and the column name. "Kaizer Boab" <kaizer_boab@yahoo.co.uk> wrote in message news:20040103165320.23958.qmail@pb1.pair.com... > I am trying to build a shopping cart for my college project. I am able to > display items from the database, add items to the cart, but I am unable to > view the items that are in the cart. In my "view_cart.php" page I receive > the following error: > > "You have an error in your SQL syntax. Check the manual that corresponds to > your MySQL server version for the right syntax to use near 'IN (64) ORDER BY > dvd.dvd_title ASC' at line 1". > > The error appears to be from this part of my script: > > $query = 'SELECT * FROM dvd IN ('; > foreach ($_SESSION['cart'] as $key => $value) { > $query .= $key . ','; > } > $query = substr ($query, 0, -1) . ') ORDER BY dvd.dvd_title ASC'; > $result = mysql_query ($query) or die(mysql_error()); > > Could someone please tell why the query is not working? > Thanks in advance.

« previous php.windows (#22494) next »