Ive been trying to figure this out for the better half of two months and not found a solution. I can find plenty of information for building the data for my Types table using recursive function but not for my actual data table. I could be using the wrong terminology. I want to add this is not for building a menu but for building dynamic forms into sections.
If I drop the parent column I can get things to work but I need the extra level.
These are the test tables
types
=====
id name parent
1 module1 0
2 module2 0
3 component1 1
4 component2 1
5 component3 2
6 component4 2
items
=====
id name type_id
1 item1 3
2 item2 3
3 item3 4
4 item4 4
5 item5 5
6 item6 5
7 item7 6
8 item8 6
The result Im trying to achieve
desired output
==============
module1
component1
item1
item2
component2
item3
item4
module2
component3
item5
item6
component4
item7
item8
Any solution to this kind of problem? Table changes, links, or examples? Thanks.