I have been developing ban system with temporary banning system and I'm looking if there's anyway to update a row to specific value using a timer within MySQL. For instance,
I need my field banned
to be set to 0 where the rowid
is X.
UPDATE mytable SET banned=0 WHERE rowid=X
- But this query has to be done within X minutes or seconds specified, like if we could delay it.
- Banning a user temporarily for 60 seconds, query sent at that time:
"UPDATE mytable SET banned=1, unbanon=NOW()+60 WHERE rowid=X"
.
Could I possibly get MySQL to automatically set banned
variable to 0 after 60 seconds has passed?
Thank you.