How do I create a nested list inside of a while loop?

前端 未结 3 637
孤街浪徒
孤街浪徒 2021-01-21 20:29

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

3条回答
  •  再見小時候
    2021-01-21 21:02

    Update your while loop to the following:

    while ($row = $result->fetch_assoc()) {
    
    if($row['drinks_category_id'] != $last_category) {
     if($last_category != 0) echo '
'; echo "

" . $row['drinks_category_title'] . "

"; echo "
    "; } echo "
  • " . $row['drink_name'] . "
  • "; $last_category = $row['drinks_category_id']; } if($last_category != 0) echo "
";

提交回复
热议问题