Users Online SQL SQL 

Status
Not open for further replies.
Code:
$getUsers = mysql_query("SELECT * FROM users");

tomsaundo - Users Online SQL - RaGEZONE Forums


- Martin
 
i just go online and count them by hand..... its pretty accurate....
 
Last edited:
I looked through this entire thread and absolutely none of this is right. Pheonix stores the array/dictionary/list/(what ever it is) of live connections in the database as positive integer. That is the most reliable online count. For the people that are doing the following:

Code:
[COLOR="red"]print mysql_num_rows(mysql_query("SELECT users_online FROM server_status"));[/COLOR]

You are completely wrong. First of all this will always be "1"?

For the people doing the following:

Code:
[COLOR="red"]print mysql_result(mysql_query("SELECT COUNT(*) FROM users WHERE online = '1'"), 0);[/COLOR]

or

Code:
[COLOR="Red"]print mysql_num_rows(mysql_query("SELECT * FROM users WHERE online = '1'"));[/COLOR]

... you are again wrong. This will fetch all the users with an online status of 1. If your vps randomly restarts or the emulator randomly quits it does not restore everyone to online = '0'. Some will still be left as online = '1'.

With all that being said, I imagine a lot of you (for some odd reason) are all wondering what is the correct way to gather the online count? The most proper way to find the online count in Phoenix is by doing the following:

Code:
[COLOR="SeaGreen"]$hostname = 'localhost';
$port = 8889;
$username = 'root';
$password = 'root';

$database = 'pheonix_database';

mysql_connect("{$hostname:$port}", $username, $passord);
mysql_select_db($database);

print mysql_result(mysql_query("SELECT ss.users_online FROM server_status ss LIMIT 0,1;"), 0);[/COLOR]

Hopefully you will all learn from this. For the record, I cannot believe we are actually discussing how to get the online count... it truly explains so much. Aim high?
 
I looked through this entire thread and absolutely none of this is right. Pheonix stores the array/dictionary/list/(what ever it is) of live connections in the database as positive integer. That is the most reliable online count. For the people that are doing the following:

Code:
[COLOR="red"]print mysql_num_rows(mysql_query("SELECT users_online FROM server_status"));[/COLOR]

You are completely wrong. First of all this will always be "1"?

the query is right for phoenix..

PHP:
SELECT users_online,rooms_loaded FROM server_status
tomsaundo - Users Online SQL - RaGEZONE Forums


mysql_num_rows will give u 1 though
 
Last edited:
Status
Not open for further replies.
Back