I'm trying to store the contents of a shopping cart in a cookie... So I thought the best way would be to hold the product id and quantity in an array.
I'm serialiZing the array when I store it but when I try to access it at a later stage it's converting to a boolean, hence I can't access the darn thing.
Here's my code...
All seems to be well storing the cookie... When I'm trying to access the cookie with the following code...$basket[$product_id] = $qty;
$basket = serialize($basket);
$basket = unserialize($basket);
echo gettype($basket); -----> Shows "array"
I'm getting the error: Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in...if(isset($_COOKIE[basket]))
$basket = unserialize($_COOKIE[basket]);
... more code
If I run a
Anyone any ideas??? Even if I type cast the booloan to an array it still won't work?echo gettype($basket); ------> Shows "boolean"??