i have recently created a 'members list' which shows all registered users, and highlights admin in blue.
here is memberslist.php:
PHP Code:
<?
include("include/session.php");
?>
<?php
//process.php
$host="mysql4.freehostia.com";
$username="liaall_users";
$password="********";
$db_name="liaall_users";
$tbl_name="users";
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select db");
$query = mysql_query("SELECT * FROM `users` ORDER BY username ASC,username") or die(mysql_error());
?>
****HTML HERE****
<?php
while($rows=mysql_fetch_array($query)){
?>
<tr>
<td align="center">
<?php
if($rows['userlevel']=='9'){
echo '<a href="http://www.shiftysplayground.co.cc/userinfo.php?user='.$rows['username'].'"><font color="blue">'.$rows['username'].'</font></a>';
}
else{
echo '<a href="http://www.shiftysplayground.co.cc/userinfo.php?user='.$rows['username'].'">'.$rows['username'].'</a>';
}
?>
</td>
</tr>
<?php
}
?>
****HTML HERE****
i wanted to achieve the same thing with 'view_active.php', which is a different setup from 'memberslist.php'. in order to do this i would need to retrieve data from 2 seperate tables.(select all from table 'active users' and userlevel from table 'users')
here is view_active.php:
PHP Code:
<?
$q = "SELECT username FROM ".TBL_ACTIVE_USERS
." ORDER BY username ASC,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";
}
else if($num_rows > 0){
/* Display active users, with link to their info */
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
echo "<tr><td><font size=\"2\">\n";
for($i=0; $i<$num_rows; $i++){
$uname = mysql_result($result,$i,"username");
echo "<a href=\"userinfo.php?user=$uname\">$uname</a> | ";
}
echo "</font></td></tr></table><br>\n";
}
?>
can anyone help me? your help would be very appreciated! thanx
Bookmarks