I have a weird problem with one of my sites. I use session_id stored in a cookie for setting the current cart id in the database. I got something like this:
function getCartID(){
if(isset($_COOKIE["cartID"]))
return $_COOKIE["cartID"];
else {
$expire = time()+3600*24*30;
$newCartID = session_id();
setcookie("cartID",$newCartID,$expire);
return $newCartID;
}
}
Then I save the cart to MySQL database. It works fine, always worked fine everywhere I checked. But recently I got an info from my client that some users can't order their products (I'm not sure if it's "some" or "only one"). They add products to the cart, but when they go to cart page, the cart is empty (I have a screen capture of this happening). So it seems that they have the cookies turned off. But the cookies seem to work fine. They don't get the info that cookies should be enabled to order products and I even sent a simple sample page checking the cookies, and it's OK.
I've checked the database for copies of the same cart ids. This is the only explanation I came up with at this moment. And there are none.
Am I doing something wrong here? Is there any way to check what's going on here?