Jump to content


Photo

Deleting users by time


  • Please log in to reply
1 reply to this topic

#1 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 11 July 2006 - 04:24 AM


I am trying to delete all users from table usersonline after 30 minutes of inactivity.  The query runs, but nothing happens.  How else can I approach this?

Thanks in advance Jay.
$query="SELECT * FROM usersonline WHERE DATE_SUB(NOW(), INTERVAL 30 MINUTE) <= LastTime";


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 11 July 2006 - 08:27 AM

The following should work, provided ListTime is a datetime field (untested):

SELECT * FROM usersonline WHERE LastTime + INTERVAL 30 MINUTE <= NOW()

Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users