Hey! Im making a forum and Im trying to pull out moderators for each forum from a mysql db. I've written a function at the top of the document...
function get_moderators($BID) {
global $BID;
$result = mysql_query("SELECT * FROM newrepublic_moderators WHERE BID = '$BID';");
if(mysql_num_rows($result)) {
while($r = mysql_fetch_array($result)) {
$getuser = mysql_query("SELECT * FROM newrepublic_members WHERE ID = '$r[MID]';");
$gu = mysql_fetch_array($getuser);
$mods = "<a href=\"profile.php?mode=member&MID=$gu[ID]\">$gu[username]</a>, ";
}
} else {
$mods = "No moderators!";
}
return $mods;
}
This is the line later in the document where I call the function...
echo "Forum Moderators:<br> " . get_moderators($BID) . "<br><Br>";
The problem is, is that if there's more than one moderator per forum, it's only displaying the mod that was last added to the DB. It doesn't show all the mods.
What am I doing wrong?
Thanks, Stezz.