Hello all, I want to make a select box containing category list ordered by category name, where each category may have a parent category or endless child category. I found that the case is very similar to forum and subforum, but I don't have left_id or right_id in my table.
Database table:
category_id
parent_id
category_name
description
1
0
name A
this category doesn't have parent category
2
0
name B
this category doesn't have parent category
3
2
name C
this category is under category 2
4
1
name D
this category is under category 1
5
3
name F
this category is under category 3
6
3
name E
this category is under category 3
Wanted result:
• Name A
•• Name D
• Name B
•• Name C
••• Name E
••• Name F
Can anyone help me, please? Thank you~