Hi,
Suppose I have an ecommerce website like amazon and I would like to keep track of the items that the user is looking at. I can store it in a session but i would like to save it to the database when the user quits her browser. This is only to be done when the user logs in and so I am also wondering if there is a good way to keep a session variable in sync with a database table.
I can skip the $session if the user is logged in and save it directly to the db but I want it to work both when the user logs in and not. But, when the user logs in, the db history list is synced to the $session var.
I hope it makes sense.
Thanks.
how do i save a session variable just as the user is exiting
Moderator: General Moderators
- MindOverBody
- Forum Commoner
- Posts: 96
- Joined: Fri Aug 06, 2010 9:01 pm
- Location: Osijek, Croatia
Re: how do i save a session variable just as the user is exi
Just make logout function and in it store all session data to database. Same data load up on login.