Code:
<?php
mysql_connect("localhost", "user", "pass");
mysql_select_db("db_name");
$main = "SELECT * FROM members WHERE rank = ";
# edit the ends of the following to mimic the MySQL stored data that determines ranking.
# edit the keys of the array to mimic the desired output ranking.
$sql["Leader"] = $main . "Leader";
$sql["Council"] = $main . "Council";
$sql["Senior Members"] = $main . "SeniorMembers";
$sql["Members"] = $main . "Members";
echo '<div style="text-align: center">';
foreach($sql as $key => $current){
echo "<p><u>$key</u></p><p>";
$do = mysql_query($current);
while($row = mysql_fetch_assoc($do)){
echo $row['name'] . '<br />';
}
echo '</p><p> </p>';
}
?>
try that