I thought that i could do this task with a join, but i'm not sure now.
I have database that contains a list of pledge classes and a table of people.
I want the output to come out in a format that shows the pledgeclass and then those that are in that pledgeclass and then the next pledgeclass and those people in that one and so on.
here's what i have right now.
<td valign="top" class="content_table">
<table class="news_table" bgcolor="#FFFFFF">
<?
//echo "<tr><td colspan='5' class='newstitle'> Alumni of Iota Nu </td></tr>";
//script to display the list of people
$sql = "SELECT * FROM class, alumni";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0)
{
while ($row = mysql_fetch_array($result)) {
$pledgeclass = $row['class'];
echo "<tr><td='menuh_class'>";
echo $pledgeclass;
echo "</td></tr>";
echo "<tr><td>";
$sql = "SELECT * FROM alumni WHERE pledgeclass = '$pledgeclass'";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0){
while($row = mysql_fetch_array($result))
echo "<a>";
echo $row['fname']." ".$row['lname']." ".$row['iotanu'];
echo "</a></td></tr>";
}
}
}
All that this returns is the first pledgeclass.