Ok none of the users from a group show. I want all of my members from all of my groups to show but everything is empty. <style type="text/css"> <!-- .style1 {color: #0033FF} .style2 {color: #0044FF} .style3 {color: #000000} --> </style> <?php include("config.php"); $username = $_SESSION['username']; $result = mysql_query("SELECT usergroup FROM members WHERE username='$username'"); $row = mysql_fetch_assoc($result); // The results are stored in an sql result array -we need to extract them $usergroup = $row['usergroup']; // Since we extracted it into an array, get the correct index of the array $result3 = mysql_query("SELECT * FROM members WHERE usergroup='$usergroup'") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result3 )) { // Print out the contents of each row into a table if ($usergroup == "admin" ) { echo "<span class=\"style1\">{$row['username']}</span>"; if ($usergroup == "moderator" ) { echo "<span class=\"style2\">{$row['username']}</span>"; if ($usergroup == "user" ) { echo "<span class=\"style3\">{$row['username']}</span>"; } }} } PHP: The page is empty. I have tried many things but they don't work properly. Admin group should be the color it is. Moderator group should be the color it is and usergroup should be black. Please help me out on this one. Thank you.
The algorithm does not seem right. But anyway, try this: if ($row['usergroup'] == "admin" ) { echo "<span class=\"style1\">{$row['username']}</span>"; if ($row['usergroup'] == "moderator" ) { echo "<span class=\"style2\">{$row['username']}</span>"; if ($row['usergroup'] == "user" ) { echo "<span class=\"style3\">{$row['username']}</span>"; PHP: Also, remove: usergroup='$usergroup' PHP: from the query.