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

Jason Handby jasonh at corestar.co.uk
Wed Jul 23 12:22:38 CDT 2003


> 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.
>
> I've not completely figured this out yet but that's one idea I've got on
> the subject.

Another variant I've tried in the past is to empty the basket table when the
application starts (mine was in ASP, but I guess PHP has an equivalent of
Application_OnStart() ? ) Mind you, I guess this could be pretty frustrating
if the server crashes when you're in mid-shop. (And I don't know what would
happen if you ran it on a multiple-web-server setup. Something horrible,
probably.)



Jason



More information about the thelist mailing list