Counting number of seconds spent on site by specific user an

i want to count the number of seconds each user is spending on my page. suppose X user entered the site and he entered at 8 am and leaving at 8:15 am so i want to add this 900 value in that users account assume that user visited several time earlier and 5000 is already in there account so after this visit it should …

via PHP Website Development » Search Results » ajax:

Counting number of seconds spent on site by specific user an

i want to count the number of seconds each user is spending on my page. suppose X user entered the site and he entered at 8 am and leaving at 8:15 am so i want to add this 900 value in that users account assume that user visited several time earlier and 5000 is already in there account so after this visit it should be 5900 and next time when he visits that no of seconds will be added in 5900 .please guide how to do as with javascript we can do this but it wont be stored in mysql . as i need to use this values so i want to store in mysql.
…………………………………..

Use an ajax call to php web page/service which update your database, it’s better if you can store log in and log out time and get the duration spent on site using a query.
This ( http://satoewarna.com/jqsajax/ ) will help you in calling PHP method from javascript.
…………………………………..

Since you didn’t provide any hint of how is your schema, I would do it like this:
UPDATE my_table SET seconds_spent_so_far = ifnull(seconds_spent_so_far,0) + timediff(session_end,session_start)
session_end and session_start could be fields in your table or variables if your are building your query from php.

For more info: Counting number of seconds spent on site by specific user an

PHP Website Development » Search Results » ajax

Counting number of seconds spent on site by specific user an

Share this post:

Related Posts

Leave a Comment