View Full Version : Session shopping basket suddenly not working

01-26-2007, 11:53 AM

I have a site which uses a shopping basket stored in session variables. It has been working fine for a long time but has now just stopped working. I can't identify when it stopped working and I can't see what is wrong with it, other than that it just doesn't seem to be registering the session variables (maybe??!!). Session variables are working in other places on the site, like when logging in so perhaps that is a red herring.

I did move the site to a new server but that was months ago. Having said that, I can't say if it was working after that as it is a customer's site and they have only just reported the problem.

Anyway, the code is below - it probably won't mean much out of context but if anyone can see anything obvious, please let me know. I am getting no errors, just nothing in the shopping cart.

if ($basket!=""){
if (session_is_registered("ses_basket_items")){


01-26-2007, 12:03 PM
I have got it now to add something to the basket, but when I try to add another item or update the price etc, it looses everything in the basket??

01-26-2007, 05:58 PM
Start by checking your error log and/or put the following in after your first opening <?php tag -

ini_set ("display_errors", "1");

Secondly, session_register, session_is_registered... are depreciated and only work when register_globals are on. It is highly likely that register_globals got turned off. Working code does not spontaneously stop working. It requires something to change either within the code or within the environment that the code is running.