[eluser]Unknown[/eluser]
I tried the code below, to show users status(online or offline),but it shows only offline status to all users,even if they login into the site....can anyone help me out...so that users are showed online status,when they are online and vice versa.
<?php
include 'db_connect.php';
$username = $_POST['username'];
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
if(mysql_num_rows($result)>0){
while($row = mysql_fetch_array($result)){
echo "online";
}
}
else{
echo "offline";
}
?>