Jump to content

Session Issue


son

Recommended Posts

I have a shopping cart that relies on session data, all working fine so far. Now, on website there is also facility to log in. When a user is logged in a session for user id is created as:$_SESSION['user_id'] = $row['user_id'];and user has few more options availble to users that are not logged in. The issue now is that it seems to mess up the cart session data ($_SESSION['cart']). Queries to insert data from cart page fail when a user is logged in. Printing the session array it always shows:Array ( [] => 132 )when the cart is actually empty. The user id I use to log in is 1.Adding an item to cart it will show for example:Array ( [] => 132 [441] => Array ( [fn] => 3 [var] => 0 [age] => 1 [qty] => 1 [price] => 1992.00 ) Using session data for two different purposes: Is there something I missed to do?Son

Link to comment
Share on other sites

I have a shopping cart that relies on session data, all working fine so far. Now, on website there is also facility to log in. When a user is logged in a session for user id is created as:$_SESSION['user_id'] = $row['user_id'];and user has few more options availble to users that are not logged in. The issue now is that it seems to mess up the cart session data ($_SESSION['cart']). Queries to insert data from cart page fail when a user is logged in. Printing the session array it always shows:Array ( [] => 132 )when the cart is actually empty. The user id I use to log in is 1.Adding an item to cart it will show for example:Array ( [] => 132 [441] => Array ( [fn] => 3 [var] => 0 [age] => 1 [qty] => 1 [price] => 1992.00 ) Using session data for two different purposes: Is there something I missed to do?Son
Just ignore this post: Working on another issue I found that the problem came from the fact that I tried to move stored product data back into session (in another file that is only accessed when user is logged in). That is why it only happened when user was/is logged in. Will try to remedy now...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...