我有ci_sessions表,当我运行此查询时,它为活跃用户提供m 0计数,但我已经使用不同浏览器的2个不同帐户,我的查询是我在phpmyadmin中运行
SELECT COUNT(`session_id`) AS `active_user_count`
FROM `ci_session`
WHERE `last_activity` >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 MINUTE)
AND `user_data`
LIKE '%s:9:"logged_in";b:1;%'
我想计算所有活跃用户
答案 0 :(得分:1)
试试这个:
SELECT COUNT(`session_id`) AS `active_user_count`
FROM `ci_session`
WHERE `last_activity` >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 MINUTE))
AND `user_data`
LIKE '%s:9:"logged_in";b:1;%'