PHP SessionID Update Database when browser closes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaspens
Forum Newbie
Posts: 2
Joined: Tue Jan 31, 2006 12:49 am

PHP SessionID Update Database when browser closes

Post 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
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Store a timestamp of when they are stored, write a garbage collection routine that purges records with and old / 'expired' timestamp
jaspens
Forum Newbie
Posts: 2
Joined: Tue Jan 31, 2006 12:49 am

Thanks

Post 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.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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.
Post Reply