Hi guys. I have a problem and i cant solve it b myself. Im pretty sure it has an easy solution but I just can't figure it out...
This code outputs nested unordered list, but I need it to output array, multi level:
function do_menu($parent, $menu) {
$result = do_mysql("SELECT id, title FROM pages WHERE parent='{$parent}' ORDER BY id");
if(mysql_affected_rows() != 0) {
$menu .= "<ul>\n";
while ($row = mysql_fetch_array($result)) {
$menu .= "<li><a href=\"".ADMINURL."menu/index.php?section=open&id=".$row['id']."\">".stripslashes(htmlspecialchars_decode($row['title']))."</a>";
$menu = do_menu($row['id'], $menu);
$menu .= "</li>\n";
}
$menu .= "</ul>\n";
} else $menu = false;
return $menu;
}
Can somebody help me, please?
Thanks guys
PS! If this function sucks, it's OK as I'm not very good programmer, more HTML-guy