是的,我有这个:
$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";
如果你打电话给online_status就会这样做,它会让你离线,闲着或在线。
如何更改此查询以仅显示在线人员的行?我想像WHERE last_access&lt; UNIX_TIMESTAMP() - 150,但我不确定..
这样做吗?
$query = "SELECT *
FROM users
WHERE last_access < UNIX_TIMESTAMP()+80";
它仍然向所有人展示..
答案 0 :(得分:0)
$query = "SELECT *
FROM users
WHERE last_access > UNIX_TIMESTAMP()-80";