Jump to content


Photo

DELETE where time 5 minutes ago?


  • Please log in to reply
2 replies to this topic

#1 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 01 April 2006 - 02:16 AM

I've created an online users script, the inserting and updating works fine, just need to delete the entries that are inactive before 5 minutes ago.

here's my code.

$delete_lookup = "DELETE FROM v3_usersonline WHERE time='<= " . $five . "'";
if (!$delete_lookup_result = mysql_query($delete_lookup))
{
    echo "nothing deleted because : " . mysql_error() . " the query was: " . $delete_lookup;
}
else
{
    echo "";
}


#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 01 April 2006 - 05:50 AM

DELETE FROM v3_usersonline WHERE time < NOW() - INTERVAL 5 MINUTE

#3 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 01 April 2006 - 03:32 PM

thanks for your help, i've managed to fix it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users