在php中创建Unlimited Unordered列表

Im trying to create tree form mysql generated data.

This question has been asked before, but actually it was about creating arrays. So Arrays are creating fine. i am using answer from this method.

http://stackoverflow.com/questions/8587341/recursive-function-to-generate-multidimensional-array-from-database-result

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 stucked in now putting this data in <ul> ,li list.

Please any ideas how to 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

Its getting very confusing as there are unlimited possibilited of li's..

This is a situation for recursion (a function calling itself). Starting with the list in $myLIst:

function showList ($myList)
{
    echo "<ul>";
    foreach ($myList as $row)
    {
        echo ("<li>{$row ['full_name']}</li>
");
        if  (isset ($row ['children']))
            showList ($row ['children']);
    }
    echo "</ul>
";
}