It contains the username & timestanp & world (world = where he was last ly located on the website, his location)
I have a HTML frame with a auto refresh every 30 sec.
In that refresh I want to delete all users that are not updated for 40 seconds in the table . How do I campare the Timstamp from MySQL with time. So I call the function beneath every 40 sec.
I thought of something Like this,
Note : Lastupdate is a Timestamp field !
Code: Select all
function PHP_Delete_Old_User_Online ($world)
{
include ("conn.php");
mysql_select_db($db1,$conn);
$sql = "DELETE FROM online_users WHERE now()-lastupdate > 40 AND world= $world;";
$result = mysql_query($sql,$conn);
}