How to display users who are online, in the user table there are fields id , login , last_visit ?
I tried it, but it does not work.
SELECT * FROM `user` WHERE `last_visit` < (NOW() - INTERVAL 15 MINUTE) How to display users who are online, in the user table there are fields id , login , last_visit ?
I tried it, but it does not work.
SELECT * FROM `user` WHERE `last_visit` < (NOW() - INTERVAL 15 MINUTE) Now you get those who have not been online for more than 15 minutes. Change the comparison operator:
`last_visit` > (NOW() - INTERVAL 15 MINUTE) Will work provided that last_visit is updated correctly. For example, on any user action to perform.
UPDATE user SET last_visit = NOW() WHERE id = [id_пользователя] Source: https://ru.stackoverflow.com/questions/461565/
All Articles
last_visit? There the data can get when the player logged out or after half an hour, after committing the last action. And the timezone for what is written there? Data can be written there in UTC, and you’ll see it in local time - BOPOH