MySQL PHP query always returning 1 -


this script returns one, not actual number of online users. can fix code?

$oq = "select user user_archive time > (now() - interval 5 minute)"; $oresult = mysqli_query($con,$oq); $online_users = mysqli_num_rows($oresult);  if($online_users = 1) {      echo "{$online_users} user online";     }  if($online_users != 1) { echo "{$online_users} users online";     } 

you need use == instead of =

if($online_users == 1) {      echo "{$online_users} user online";     } 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -