i have a table that has users, the pages that they visited , session id and time they spent on each page.
session_id | talentnum | page_name | time
008873e0 | user1 | test.php | 1311630222
008873e0 | user1 | test.php | 1311630215
008873e0 | user1 | index.php | 1311630222
008873e3 | user2 | test.php | 1311630216
008873e3 | user2 | index.php | 1311895032
how to find ouy how much time a user spent on each session
i think i should find how much the user spent on each page in a session then add the time?? i’m a bit confuze
edit. the time is the time() when they enter that page
any ideas?
thanks
First, get a list of visitors:
Then perform another query to get the start and end times of each visit:
Then, retrieve the results via PHP and subtract the start time from the end time to get the total length of the visit.