Hi I need a script that displays a menu with it's submenu items based upon a function. What i have now is a script that looks up a parent id. This parent id i'm trying to use in the next query. So i want to select te next submenu items. And so on so on.
I'm not really familiar with functions yet, that's where it goes wrong i guess :-)
This is the function i used, i tried to call the function within the function, but this doesn't work.
Could someone help me out how to do this? (i'm using a mysql cass btw)
Kind regards PHPfreaky (robbie)
function submenu($pid) {
global $menudb;
global $language_id;
global $site_id;
$parentid = $pid;
$sql = "SELECT * FROM menu LEFT JOIN menutitles USING (id) WHERE parent=".$parentid." AND language_id = $language_id AND site_id=$site_id AND menu.visible=1 ORDER BY sort_order"; //seek children
$menudb->SetQuery($sql);
$childern = array();
while ($row=$menudb->GetNextRow()) {
echo $row['title']." - ".$row['id']."<BR/>";
submenu($row['id'])
}
}