<ul class="sf-menu">
<?php
$menu_query ="SELECT * ";
$menu_query .="FROM `menu`";
$menu_query .="WHERE `Status` = 'Enabled'";
$menu_query .="AND `ParentMenuID` = '0'";
$menu_result = mysqli_query($connection,$menu_query);
while($row = mysqli_fetch_array($menu_result,MYSQLI_ASSOC)){
$PageID=$row['PageID'];
$ID=$row['ID'];
$LW=$row["LinkWidth"];
$menu_qry_for_page ="SELECT * ";
$menu_qry_for_page .="FROM `page`";
$menu_qry_for_page .="WHERE `ID` = '$PageID'";
$menu_qry_for_sub ="SELECT * ";
$menu_qry_for_sub .="FROM `menu`";
$menu_qry_for_sub .="WHERE `Status` = 'Enabled' ";
$menu_qry_for_sub .="AND `ParentMenuID` = '$ID'";
if(isset($LW) == 'otherlink'){
$menu_url=$row["OtherUrl"];
$menu_name=$row["MenuName"];
}
if($LW == 'page'){
$menu_result_qry = mysqli_query($connection,$menu_qry_for_page);
while($row_for_page= mysqli_fetch_array($menu_result_qry,MYSQLI_ASSOC)){
$menu_name = $row_for_page["Title"];
$menu_url = $row_for_page["Slug"];
}
}
echo "<li class=\"item4\"><a href=\"$menu_url\">$menu_name</a>";
$sub_menu_result = mysqli_query($connection,$menu_qry_for_sub);
while($row_for_sub = mysqli_fetch_array($sub_menu_result,MYSQLI_ASSOC)){
$linkWidth = $row_for_sub['LinkWidth'];
$Page_ID = $row_for_sub['ID'];
$parentMID = $row_for_sub['ParentMenuID'];
if(isset($linkWidth) == 'otherlink'){
$url_name = $row_for_sub['MenuName'];
$url = $row_for_sub['OtherUrl'];
}
if($linkWidth == 'page'){
if($menu_row_qry = mysqli_query($connection,$menu_qry_for_page)){
while($row_qry_page= mysqli_fetch_array($menu_row_qry,MYSQLI_ASSOC)){
$url_name = $row_qry_page["Title"];
$url = $row_qry_page["Slug"];
}
}
}
echo "<ul>";
if($parentMID = $ID){
echo "<li><a href=\"$url\">$url_name</a></li>";
}
echo "</ul>";
echo"</li>";
}
}
?>
</ul>
only 1 sub menu shown why :?
need help ?
thanks in advance