Jump to content

users online


CBaZ

Recommended Posts

i have an issue with this

$result2 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '0'");

$row = mysql_fetch_array($result2);

 

$result3 = mysql_query("SELECT COUNT(*) AS count FROM users WHERE permission = '1'");

$row2 = mysql_fetch_array($result3);

 

echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", " . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". ";

 

 

permission 0 are regular users

 

permission 1 are admins.

 

for some reason the regulars are ok but admins are not.. when one person logs in it will add 2 and when more sign in the number goes up for admin and regulars something is really screwy here any ideas?

Link to comment
https://forums.phpfreaks.com/topic/61475-users-online/
Share on other sites

something like this?

 

if (permission== 1) {

echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." / $row2[count]" . ", "; }

else { ". ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." / $row[count]" . ". "; }

 

Link to comment
https://forums.phpfreaks.com/topic/61475-users-online/#findComment-306008
Share on other sites

if (permission == 1) {

echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline Admin" . ($usersOnline != 1 ? "s" : "") ." of $row2[count]" . ", ";

} else {

echo "ATM:" . ($usersOnline != 1 ? "" : "") . " $usersOnline User" . ($usersOnline != 1 ? "s" : "") ." of $row[count]" . ". "; }

 

this produces no more admin = 0

when logged in as admin says 2 users of 26 online hmmmph

Link to comment
https://forums.phpfreaks.com/topic/61475-users-online/#findComment-306025
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.