Page 1 of 1

PHP SessionID Update Database when browser closes

Posted: Tue Jan 31, 2006 12:50 am
by jaspens
I have a shopping cart that uses the setcookie session. When you add an item into the cart it removes the item from the database and stores the value in a new table under the sessionid.

The problem comes when the user decides not to check out and closes their browser. The items are now tied up in the temp database. I need help developing a function that will reverse this.

Please Help

Posted: Tue Jan 31, 2006 1:48 am
by josh
Store a timestamp of when they are stored, write a garbage collection routine that purges records with and old / 'expired' timestamp

Thanks

Posted: Tue Jan 31, 2006 2:02 am
by jaspens
Thank you for responding. I thought about doing that, but the problem is returning the values to the other database. If they were purchased that would be one thing but if they weren't and the window was closed...then the timestamp would return all purchased and not purchased to the original database.

Posted: Tue Jan 31, 2006 3:53 am
by Jenk
Don't remove the items from the originating database..

Keep a count of how many of a particular item you have in stock and increase/decrease that to match how man you have.