Ok, what I'm trying to do is: make it show who is online, here's the code I have:
PHP Code:
<?
include("include/session.php");
$q = "SELECT username,userlevel,email,timestamp "
."FROM ".TBL_USERS." ORDER BY userlevel DESC,username";
$result = $database->query($q);
/* Error occurred, return given name by default */
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "Database table empty";
return;
}
/* Display table contents */
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
echo "<tr><td><b>Username</b></td><td><b>Level</b></td><td><b>Email</b></td><td><b>Online</b></td></tr>\n";
for($i=0; $i<$num_rows; $i++){
$uname = mysql_result($result,$i,"username");
$ulevel = mysql_result($result,$i,"userlevel");
$email = mysql_result($result,$i,"email");
$que = "SELECT * FROM ".TBL_ACTIVE_USERS." VALUES ('$username')";
// Here's what I was testing with
if ($que == $uname) {
$online = "<img src=\"buttongreen.jpg\">";
}
else {
$online = "<img src=\"buttonred.png\">";
}
echo "<tr><td><a href=\"userinfo.php?user=$uname\">$uname</a></td><td>$ulevel</td><td>$email</td><td><center>$online</center></td></tr>\n";
}
echo "</table><br>\n";
?>
It shows everything that needs to be shown but I cant get it to show wether or not a person is online
__________________
Please login or register to view this content. Registration is FREE The future is now with 4D Realms
|