RE: Shopping Cart Woes!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One thing I always like to do is echo the query to see if the query looks
correct. Just add an

echo $query;

before your $result = mysql_query ($query) or die(mysql_error());

Then if you have something missing from your query you will be able to see.

-----Original Message-----
From: kaizer boab [mailto:kaizer_boab@yahoo.co.uk]
Sent: Saturday, January 03, 2004 10:54 AM
To: php-windows@lists.php.net
Subject:  Shopping Cart Woes!!


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.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux