Hi All,
Got a bit of a problem, but not too sure how to debug it.
I built a ticketing website where users can add tickets to a shopping cart, once added they have 30 mins to checkout otherwise the tickets are removed from the cart and the stock is replenished. The code that does this is currently attached to the 'update cart' button.
Everything seems fine and loads of users have successfully gone through the process and checkedout, but we get the odd user now and then who complain saying when then press checkout, they get an error message saying their cart is empty even though they've added tickets to it.
Now, the only way they can see this error is if their session is not found in the 'cart' table of the database - this is where everything is store for active carts. The users session ID is started as soon as they add something to the cart.
This is that part of the code:
//Is Cart Empty
function isCartEmpty()
{
$isEmpty = false;
$sid = session_id();
$sql = "SELECT id
FROM cart
WHERE sessionID = '".$sid."'";
$result = mysql_query($sql);
if (mysql_num_rows($result) == 0) {
$isEmpty = true;
}
return $isEmpty;
}
if (isCartEmpty()) {
setError('<li>Your cart is empty.</li>');
}
Is there anything there that you think may be causing this?
Thanks for any help.