Results 1 to 4 of 4

Thread: Object stored in session not retained

Threaded View

  1. #1

    Thread Starter
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Object stored in session not retained

    I'm storing a shopping cart object in a session, it works fine when navigating pages in the application, the object is being retained intact, however if I close the browser and go back to a page it doesn't retain. Either the items member of the object is being cleared, or the session is being destroyed. I've used sessions before storing simple strings for a login system, it allowed me to close the browser and return to the page still logged in, thats what I'm trying to achieve.

    Here's how I'm storing the object in the session:
    Code:
    <?
    
    	require_once("clsCart.php");
    
    	session_start();
    	
    	if(!isset($_SESSION['cart']))
    	{
    		//cart doesn't exist
    		$_SESSION['cart'] = new cart;
    	}
    Edit: Sometimes it is working, when I close and open it back up but sometimes not. I'm not leaving any length of time between closing and opening.

    Cheers all
    Last edited by the182guy; Jun 24th, 2007 at 04:36 AM.
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width