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
Post a Comment