PHP tree menu nested lists problem
<p>My code for some reason is displaying my nested lists for my tree menu all wrong can someone help me correct this problem? So that my nested lists are nested correctly for my tree menu.</p>

<p>Here is my PHP code.</p>

<pre><code>function category_tree($parent = 0, $parent_url = ''){
    echo "&lt;ol&gt;";
    $mysqli = mysqli_connect("localhost", "root", "", "sitename");
    $q = "SELECT id, category, url FROM categories WHERE parent_id = '" . $parent . "' ORDER BY category asc";
    $r = mysqli_query($mysqli, $q);
    while($rs = mysqli_fetch_array($r) ){
        $url = $parent_url . $rs['url'];
        echo '&lt;li&gt;&lt;a href="' . $url . '" title="' . $rs['category'] . ' Category Link"&gt;' . $rs['category'] . '&lt;/a&gt;&lt;/li&gt;';
        category_tree($rs['id'], $url);
    }
    mysqli_free_result($r);
    echo "&lt;/ol&gt;";
}
</code></pre>
