Working a on custom PHP/MySQL shopping cart. The cart contents are stored in a table with the associated session_id.
Here is the working beta site:
I want to show the number of items in () in the cart next to the "Cart" link in the top right of the header. Each time a product is added/removed to the cart, I update the cart database. I then query the table using the session_id to count the number of items in the cart for that session. I save that value in a session variable.
$_SESSION["total_cart_products"] = $cart_total_products['total_cart_products'];
Everything works great...and the quantity is updated. But the product count session variable is loosing the value after a set time, which makes sense, the session timed out. What doesn't make sense is that the cart listing still works even though the SQL that generates the listing uses the session_id ($session_id = session_id();) value to query the database.
Do those two values have a different time-outs? What am I doing wrong?
Thanks
Brett