I want to make the online/offline status, i made a table user_status
and i want to add in the header sql query so every time the user loads a page the table will be updated with that time;
user_status table is : user_id | last_activity_time ;
user_id
is from the table users
;
i added this in the header:
//check update last_time_active
$date = date("Y-m-d H:i:s");
$query = mysql_query("update user_status SET last_activity_time=$date ");
?>
how can i add also the user? if he's logged in, check his user_id
and update the table with the user_id
and the last_activity_time
? is it correct?
after that i will want to add in specific pages a text next to the username (online/offline).
Thanks all!