CBaZ Posted July 24, 2007 Share Posted July 24, 2007 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? Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 24, 2007 Share Posted July 24, 2007 your counting the number of 0 and 1's lol the code is correct what is it u want? Quote Link to comment Share on other sites More sharing options...
CBaZ Posted July 24, 2007 Author Share Posted July 24, 2007 i want it to count the 2 admin users seperately right now its throwing it all together. the regulars and the admins before i just had the regulars that was fine but i thought i could add the admins as well Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 24, 2007 Share Posted July 24, 2007 I think use one query for all, And then in if statement do it like this if (permission== 0) { regular user code here} else {admin code here} Hope this will give u some idea. Quote Link to comment Share on other sites More sharing options...
CBaZ Posted July 24, 2007 Author Share Posted July 24, 2007 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]" . ". "; } Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 24, 2007 Share Posted July 24, 2007 Yeh like that, Try it, it will work hopefully for u. Quote Link to comment Share on other sites More sharing options...
CBaZ Posted July 24, 2007 Author Share Posted July 24, 2007 it has sum bugs. its not working for me as of now i am sure i gotta change the code the dots ahhh Quote Link to comment Share on other sites More sharing options...
CBaZ Posted July 24, 2007 Author Share Posted July 24, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.