Yes, so I have this:
$query = "SELECT *,
CASE
WHEN last_access < UNIX_TIMESTAMP()-150 THEN 'offline'
WHEN last_access < UNIX_TIMESTAMP()-80 THEN 'idle'
ELSE 'online'
END AS online_status
FROM users";
That'll do if you call online_status, it will either give you offline, idle or online.
How can i change this query to only show the rows of those who are online? I guess something like WHERE last_access < UNIX_TIMESTAMP()-150, but im not sure..
Will this do it?
$query = "SELECT *
FROM users
WHERE last_access < UNIX_TIMESTAMP()+80";
It still shows everyone..