When I refresh page current user's date gets updated while other users date stays the same, so i'm trying to find inactive users and delete rows from online table after 1 minute.
$date = ("UPDATE `online` SET `date` = (localtime()) WHERE `username` = '".$_SESSION['users']."'");
$date_fetch = mysql_query($date);
if(mysql_query("DELETE * FROM `online` WHERE `date` < (localtime()-60)"));
Use DATE_SUB
to subtract from a datetime:
if(mysql_query("DELETE * FROM `online` WHERE `date` < DATE_SUB(localtime(), INTERVAL 1 MINUTE)"));
And as others have stated on your other questions: Do not use mysql_ functions anymore. They are depreciated, and are removed in the latest version of PHP. See this post for more info.
Firstly stop using mysql_query use mysqli_query
if(mysql_query("DELETE * FROM `online` WHERE date < DATE_SUB(now(), INTERVAL 1 MINUTE)"));