[thelist] in-principle, PHP/mySQL shopping basket question

Marek Kilimajer kilimajer at webglobe.sk
Thu Jul 24 05:37:17 CDT 2003


You can implement your own garbage collector. Use 
session_set_save_handler() to set your session handling function. The 
last parameter is for garbage collector function, its implementation 
should be pretty straighforward.

john at johnallsopp.co.uk wrote:
> That makes the problem worse, as I was intending to write the basket to
> the database. If I do that and the session variable is cleared up, then I
> still have a database with a basket in it ... but (the penny drops) .. I
> guess you're saying I shouldn't bother with the database, just store an
> array of product ids in session variables. That makes sense.
> 
> J
> 
> 
>>Garbage collector is designed for this. Everytime you call
>>session_start(), there is session.gc_probability % probability that
>>garbage collector starts up and removes all session files that have not
>>been accessed for session.gc_maxlifetime seconds.
>>
>>john at johnallsopp.co.uk wrote:
>>
>>
>>>Hiya
>>>
>>>In principle, how does this work? I'm developing a shopping basket for
>>>one of my sites in PHP/mySQL. So the client arrives, gets a session
>>>id, adds things to their basket and then leaves without buying
>>>anything.
>>>
>>>What rule do I implement to discard the basket. I can't tell that
>>>they've left the site barring timeout, and what if someone wants to
>>>keep their basket open overnight or similar?
>>>
>>>What have I missed?
>>>
>>>Cheers
>>>J
>>>
>>>
>>
>>--
>>* * Please support the community that supports you.  * *
>>http://evolt.org/help_support_evolt/
>>
>>Evolt.org conference in London, July 25-27 2003.  Register today at
>>http://evolt.org.uk
>>
>>For unsubscribe and other options, including the Tip Harvester
>>and archives of thelist go to: http://lists.evolt.org
>>Workers of the Web, evolt !
> 
> 
> 
> 



More information about the thelist mailing list