Is there a way for me to change this MYSQL statement
$query = "SELECT Monsters.ID AS `mID`,
Monsters.Name AS `MName`, Monsters.MonsterType_ID,
MonsterType.Name FROM Monsters ";
$query .= "inner join MonsterType ON Monsters.MonsterType_ID = MonsterType.ID
ORDER BY MonsterType.Name ASC";
$result = $mysqli->query($query);
if ($result && $result->num_rows > 0) {
echo "<div class='row'>";
echo "<center>";
echo "<h2>The Monster Database</h2>";
echo "<table>";
echo "<tr><th>Name</th><th>Type</th>
<th></th><th></th></tr>";
while ($row = $result->fetch_assoc()) {
echo "<tr>";
//Output FirstName and LastName
echo "<td>" .$row["MName"]."</td>";
echo "<td>" .$row["Name"]."</td>";
such that this image Monster Database Names and Types is ordered as it is by Type, but the Monster Names associated with that type are also alphabetized? So for the Beast Type, it'd be listed as
Boar Beast
Grizzly Bear Beast
Panther Beast
Polar Bear Beast
Titanoboa Beast
Wolf Beast
Thank you!
EDIT: Solution was MonsterType.Name ASC, MName ASC. Thank you everyone!