Jump to content

Archived

This topic is now archived and is closed to further replies.

crouchjay

Deleting users by time

Recommended Posts


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.
[code]$query="SELECT * FROM usersonline WHERE DATE_SUB(NOW(), INTERVAL 30 MINUTE) <= LastTime";[/code]

Share this post


Link to post
Share on other sites
The following should work, provided ListTime is a datetime field (untested):

[code]SELECT * FROM usersonline WHERE LastTime + INTERVAL 30 MINUTE <= NOW()[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.