I am trying to turn flat mysql rows into a tree structure. Here is the id's of the categories and Sub categories
Array ( [50] => Array ( [70] => Array ( [0] => Array ( [73] => Array ( [80] => Array ( )
)
[74] => Array
(
)
[75] => Array
(
)
)
)
[71] => Array
(
[0] => Array
(
)
)
[72] => Array
(
[0] => Array
(
)
)
[73] => Array
(
[0] => Array
(
[80] => Array
(
)
)
)
[74] => Array
(
[0] => Array
(
)
)
[75] => Array
(
[0] => Array
(
)
)
[80] => Array
(
[0] => Array
(
)
)
)
[51] => Array
(
[76] => Array
(
[0] => Array
(
[77] => Array
(
)
)
)
[77] => Array
(
[0] => Array
(
)
)
[78] => Array
(
[0] => Array
(
[79] => Array
(
[81] => Array
(
)
)
)
)
[79] => Array
(
[0] => Array
(
[81] => Array
(
)
)
)
[81] => Array
(
[0] => Array
(
)
)
)
)
I wan the output in this way
<ul id="red" class="treeview-famfamfam">
<li>50
<ul> <li> 70
<ul><li> 73 <ul>
<li> 80</li></ul>
</li>
<li> 74</li>
<li>75 </li>
</ul>
</li>
<li>71</li>
<li> 72</li>
</ul>
</li>
BAsically i need to build a tree with categories sub categories sub sub .... categoreis etc. Thanks in advance