hello guys, just want to ask some newbie questions. i have a table named "students" in my database, the field names are "Lastname", "Firstname" and "Highschool". i want to sort my query by highschool field. i want to show that query results in table form. how can i sort by showing all schools in the database and under each schools, i want all students' names that are in the same school.
i use these codes:
<?php
$query = "SELECT * FROM students ORDER by highschool";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_assoc($result)) {
echo "<table border='1'>";
echo "<tr>";
echo "<th align='left' width='450'>" . $row['highschool'] . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td width='450'>" . $row['lastname'] . ", " . $row['firstname'] . "</td>";
echo "</tr>";
echo "<p> </p>";
}
?>
i have some image attachment to explain more.