user3251400
user3251400

Reputation: 17

How to check does user is not active more than 1 minute

Hello I tried to update a row in table if somebody is offline more than 1 minute, and set LoggedIn then as 0, but my SQL query doesn't work, what I do wrong?

"UPDATE acc SET LoggedIn='0' WHERE LastTimeActive<(NOW(), INTERVAL 1 MINUTE)";

Upvotes: 0

Views: 56

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270011

You are missing date_sub():

UPDATE acc
    SET LoggedIn = '0'
    WHERE LastTimeActive < date_sub(NOW(), INTERVAL 1 MINUTE);

Upvotes: 1

Related Questions