I can’t get all the sub-menu items to show on the “New Motorcycles” section on http://www.mattmaclennan.co.uk/a2. For example, Adventure should have three options coming off, not one. Here is the code I have used.
<?
$output = mysqli_query("SELECT * FROM bikes, bikeTypes WHERE bikes.model_id = bikeTypes.model_id GROUP BY bikeTypes.model_id");
while($row = mysqli_fetch_array($output))
{
echo "<li><a href='test.php?id=" . $row['model_id'] . "'>".$row['model'].'</a><ul>';
echo "<li><a href='details.php?id=" . $row['bike_id'] . "'>" . $row['bikeName'] . "</a></li>";
echo '</ul>';
echo '</li>';
}
//var_dump($result);
?>
Any ideas guys? Thanks!
EDIT: Here is the structure of both tables from phpMyAdmin:
bikeTypes table:
bike types table http://www.mattmaclennan.co.uk/a2/images/bikeTypesTable.jpg
bikes table:
bikes table http://www.mattmaclennan.co.uk/a2/images/bikesTable.jpg
Try this:
If you see that the query I have written has a
LEFT JOINin it.What are you doing is treated as anINNER JOINby the DB engine.But the thing you need here is
Just see where you want to close ul and li.