Hi all ...

During a session a user causes information to be added to a temporary database table. At the end of the session, the information has to be removed. How can I tell when a session has ended so that I can clear the rows from the table that belonged to that session id?

Regards ...

G-fer

Hi all ...

During a session a user causes information to be added to a temporary database table. At the end of the session, the information has to be removed. How can I tell when a session has ended so that I can clear the rows from the table that belonged to that session id?

Regards ...

G-fer

I think I understand what you are asking. :)

If I were you, when someone logged in and created a session, I would get the session_id() and store it in the database. Then, I would have a cron job that would scan the temporary database at a sane interval (10-15min) and check to ensure the session_id() still exists. You should be able to find the path to the session using session_save_path(), which tells you where your session files are going.

Not a coded answer, but a big nudge in the right direction, I think.

My 2ยข. Hope it helped. :)

Hi Wraithmanilian,

Thanks for the answer. It's perfect... solves a few other problems too.

I gotta spend more time thinking outside the square :)

Regards .... G-fer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.