I want to update the 'last_activity' or 'last_seen' value of user in database.. I wrote following code to achieve this:
$_SESSION['LAST_ACTIVITY'] = time();
$lastseen = $_SESSION['LAST_ACTIVITY'];
$lastseen = date("h:i:sa",$lastseen );
$query = "UPDATE `users` SET `lastseen` = '$lastseen' WHERE `username`='$username'";
$query_run = mysql_query($query);
But the problem is that above code will run only one time .I want it to run each and every second so I could get the latest value of 'last seen'.
PS:I have searched a lot on internet but didn't get specific answer .Please help me.
You don't really want to it - trust me...
but ok
use javascript to make a asynchronous call to a php page where you update the database... if you use jquery use the built-in function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.