this is a piece of the php file
<div id='cssmenu' >
<?php
include '/include/functions.php';
echo BuildMenu(0, Menu());
?>
</div>
And these or the two functions in the functions.php
function Menu() {
$con = getConnection();
$menu = array(
'items' => array(),
'parents' => array()
);$result = mysqli_query($con, "SELECT id,title,link,parentid FROM dyn_menu ORDER BY id;");
while ($items = mysqli_fetch_assoc($result)) {
$menu['items'][$items['id']] = $items;
$menu['parents'][$items['parentid']][] = $items['id'];
}
mysqli_free_result($result);
mysqli_close($con);
return $menu;
}
function BuildMenu($begin, $menu) {
$html = "";
if (isset($menu['parents'][$begin])) {
$html .= "<ul>
";
foreach ($menu['parents'][$begin] as $itemId) {
if (!isset($menu['parents'][$itemId])) {
$html .= "<li>
<a href='" . $menu['items'][$itemId]['link'] . "'>" . $menu['items'][$itemId]['title'] . "</a>
</li>
";
}
if (isset($menu['parents'][$itemId])) {
$html .= "<li>
<a href='" . $menu['items'][$itemId]['link'] . "'>" . $menu['items'][$itemId]['title'] . "</a>
";
$html .= BuildMenu($itemId, $menu);
$html .= "</li>
";
}
}
$html .= "</ul>
";
}
return $html;
}
The php file doesn't show the generated html that the php script should provide, in a live enviroment, but it does in netbeans. And i don't know why or how i can resolve this issue.