I\'m having trouble trying to get a nested < ul > inside of a while loop. I\'m not sure if this even possible so i\'m open to alternatives.
Here\'s a quick image of w
$result = $conn->query($sql) or die(mysqli_error());
$last_category = 0;
while ($row = $result->fetch_assoc()) {
if($row['drinks_category_id'] != $last_category) {
// close previous
if( $last_category != 0 ) echo "";
// new title
echo "" . $row['drinks_category_title'] . "
";
// new
echo "";
$last_category = $row['drinks_category_id'];
}
echo "- " . $row['drink_name'] . "
";
}
// close last
if( $last_category != 0 ) echo "
";