please guys i am making an app and i want to show the number of users online on the app i have this code
function whoisonline()
{
//what are my variables values
$email=$_SESSION['jwp_email'];
$sqloo="SELECT `id` FROM users WHERE email='$email'";
#mysql_query($sqloo)
if ($run=mysql_query($sqloo)) {
$b=mysql_fetch_assoc($run);
$b['id'];
$c=$b['id'];
}
$ip=$_SERVER['REMOTE_ADDR'];
$ip_ua=$_SERVER['HTTP_USER_AGENT'];
$time=time();
$usr_id=$c;
//(`id`, `usr_id`, `usr_ip_address`, `usr_logged_out`)
$sqlpp="SELECT * FROM usr_online WHERE usr_id = $usr_id";
if ($running=mysql_query($sqlpp)) {
};
if (mysql_num_rows($running) == 0) {
$sql="INSERT INTO `usr_online` VALUES ('','$usr_id','$ip','$time','0')";
mysql_query($sql);
}
else
{
if (mysql_num_rows($running) >= 1)
{
$sql="UPDATE `usr_online` SET `time`='$time',`usr_ip_address`='$ip',`usr_id`='$usr_id',`usr_logged_out`='0' WHERE usr_id = '$usr_id'";
mysql_query($sql);
}
}
$sss="SELECT * FROM usr_online";
$gg=mysql_query($sss);
$d=mysql_fetch_assoc($gg);
//print_r($d);
}
please i want to show all the users online but the problem is that when i do a select all usr_id in the atabase it just return only one row of data please what can i do...