Click to See Complete Forum and Search --> : Time Tracking with SQL (MySQL)


tyveil
10-18-2006, 04:58 PM
Hello everyone,

I am fairly new to SQL (MySQL) and I am trying to figure out the best way to track time spent (down to the minute) on a certain web page of mine. I have seen SQL has a timestamp command of NOW() that returns the time/date in HH:MM:SS which would work perfectly for me.

Now my question is, would I be able to timestamp when a user enters my page and store that time into my database - followed by another timestamp when the user exits, logs out or closes the browser window? Now thinking logically, I would also like SQL to subtract the two times and return the amount of minutes the person spent on that page - again storing that value in the database.

That is my situation, now is this feasable with SQL? Or is there a better way of going about getting this done?

chazzy
10-18-2006, 06:33 PM
how are you catching when a user exists/logsout or closes the window?