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

前端 未结 3 677
孤街浪徒
孤街浪徒 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:08

    Instead of having 3 tables, you could just add a category_id to your drinks table, just to simplify things. Then you can do this:

    SELECT drink_name, (SELECT drnk_category_title FROM drinks_category WHERE drink_category_id = drink_category // THE COLUMN I SUGGESTED //) AS title FROM drinks
    

    And then you can loop the result and build the nodes you desire really easily

提交回复
热议问题