Log in

View Full Version : query to get number of users online?


willms_jay
04-25-2003, 09:40 AM
can anyone help me with a query that will get number of users online?

i tried this :

// Returns the total amount of people online RIGHT NOW!

function getTotalUsersOnline() {

$query = "SELECT userid FROM `session` WHERE userid != 0";

$result = mysql_db_query("sampleci_samplecitynet", $query);



if ($result) {

$numOfRows = mysql_num_rows ($result);

}

return $numOfRows;



} // end getTotalUsersOnline()

but it doesn't give me the correct number of users online.

can someone assist me?

thanks in advance!

..jordan

Xenon
04-25-2003, 11:18 AM
you have to also look how long the users in session are inactive ;)

look into index.php to see the proper query :)