I am a beginner to PHP, I have a table dyn_menu to store menu items in the database. The parent_id is the id of the parent menu item. I need to generate an array like,
array[
-1
--3
-2
--4
---6
-5
]
The table shown below.Please help me to solve this issue.
+----+-----------------+----------+-----------+
| id | label | link_url | parent_id |
+----+-----------------+----------+-----------+
| 1 | Home | # | 0 |
| 2 | About | # | 0 |
| 3 | Sub home | # | 1 |
| 4 | Sub contact | # | 2 |
| 5 | About Us | # | 0 |
| 6 | Sub sub contact | # | 4 |
+----+-----------------+----------+-----------+
Thanks,