My database is storing a list like this:
ID | name
--- -----
1 | search
2 | search.categories
3 | search.categories.accessories
4 | search.categories.accessories.glasses
5 | search.categories.accessories.hats
6 | filters
7 | filters.payments
8 | filters.payments.creditcard
9 | filters.payments.debitcard
Now I want to SELECT it in a recursivelly array just like this:
[
name, childs[
name, childs[ ... ],
name, childs[ ... ],
name, childs[
name, childs[ ... ],
name, childs[ ... ],
],
],
name, childs[
name, childs[ ... ],
name, childs[ ... ],
name, childs[
name, childs[ ... ],
name, childs[ ... ],
],
]
]
What is the best way to achive this? Directly from MySQL or manually string handling?