I'm trying to create tree from MySQL generated data.
This question has been asked before, but actually it was about creating arrays. So arrays are creating fine. I am using an answer from this question.
This is the array I am getting:
Array
(
[0] => Array
(
[employee_id] => 1
[organization_id] => 1
[parent_organization_id] => 0
[full_name] => Mohammad Salim Khan
[employee_order] => 1
[children] => Array
(
[0] => Array
(
[employee_id] => 2
[organization_id] => 2
[parent_organization_id] => 1
[full_name] => Ali Khan
[employee_order] => 2
[children] => Array
(
[0] => Array
(
[employee_id] => 5
[organization_id] => 4
[parent_organization_id] => 2
[full_name] => Nadeem Khan
[employee_order] => 3
[children] => Array
(
[0] => Array
(
[employee_id] => 7
[organization_id] => 5
[parent_organization_id] => 4
[full_name] => Sajjad Ali
[employee_order] => 4
)
)
)
)
)
[1] => Array
(
[employee_id] => 3
[organization_id] => 3
[parent_organization_id] => 1
[full_name] => Kamran Durrani
[employee_order] => 2
)
)
)
)
but I am stuck in putting this data in <ul>
/ <li>
list.
How can I put this in unordered list so that I get list like this:
<ul>
<li>Mohammad Salim Khan</li>
<ul>
//1
<li>Ali Khan</li>
<ul>
<li>Nadeem Khan</li>
<ul><li>Sajjad Ali</li></ul>
//2
<li>Kamran Durrani</li>
</ul>
</ul>
Update:
- Muhammad Salim Khan
-
- Ali Khan
-
-
- Nadeem Khan
-
-
-
-
- Sajjad Ali
-
-
-
- Kamran Durrani
It's getting very confusing as there are unlimited possibilities of li's.
- format, i have given example in end of my question. i tried many ways but none of it is working :(
– Sizzling Code Dec 03 '14 at 05:42