Discuss or request ArrowChat applications
User avatar
Posts: 3
Joined: 27 Jul 2020, 10:14


by andygrainger 05 Aug 2020, 04:05

Hi there,

Just wondering if anyone has done this already?

Displaying online users count in specified Chatroom with PHP.

In the \includes\json\receive\receive_chatroom_list.php file under START CHATROOM LIST RECEIVE there is code to query the database for the current users list but with my limited PHP coding knowledge - not 100% sure how to modify it to update a variable with just the user count (and ideally usernames). I want to pass this back to my integrated site (MyBB) so will probably add the code directly into one of its .php files.

Many thanks for your help in advance.
User avatar
Posts: 2
Joined: 22 Jan 2011, 11:47


by jvdend 05 Aug 2020, 04:28

Code: Select all
$sql = "SELECT COUNT(user_id) FROM arrowchat_chatroom_users WHERE (chatroom_id='1' AND session_time > (" . time() . " - 70))";
//$result = mysqli_query($sql);
$result = $db->sql_query($sql);
$row = mysqli_fetch_array($result);
$chatcafe_online = $row[0];