i have a script for a cart, session variables are passed along and when an item is added to the cart, i check to see if the item is already not in the cart, so i use "c_no" to check as the cart has a link to the customer.
Now if the item is not in the cart, i want to add, but if i use the c_no again it wont add to cart.
$result = mysql_query("select * from cuscart where custId = '$c_no' and productId = '$product_no'");
$row = mysql_fetch_row($result);
$numRows = $row[0];
if($numRows == 0)
{
// This item doesn't exist in the users cart,
// we will add it with an insert query
$sql = mysql_query("INSERT INTO cuscart (cartId, custId, productId, qty) VALUES('NULL', '$c_no', '$product_no', '$qty')");
The first query works but the second adds to the database ok but doesnt add the $c_no, anyone have any suggestions as to why this is happening?