[thelist] in-principle, PHP/mySQL shopping basket question
Hassan Schroeder
hassan at webtuitive.com
Wed Jul 23 12:46:55 CDT 2003
Chris W. Parker wrote:
> You table that stores the basket information should also store the time
> the basket was created and when it was last accessed (or you could call
> this modified date/time). Each time the customer accesses the cart
> (reads, modifies) you should update the date/time of the modified/last
> accessed field.
>
> Then periodically (maybe once a day, or once a week) you can have a php
> script that goes through the basket table and discards all records that
> are older than 24 hours or something like that.
Gack. Servlet engines (Java/JSP) allow you to run your own methods
when the session is ended (manually or by timeout) -- doesn't PHP
have anything like that?
<example_code origin="another homebrewed shopping cart">
public void valueBound( HttpSessionBindingEvent event )
{
System.out.println( getLogTime() + " [Cart] " + cartId + " assigned" );
}
public void valueUnbound( HttpSessionBindingEvent event )
{
System.out.println( getLogTime() + " [Cart] "+ cartId + " timed out" );
// other arbitrary stuff goes here :-)
}
</example_code>
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the thelist
mailing list