2 level dynamic navigation list menu
Hejsa.....Jeg har en list menu ud fra nedenstående php kode og eksisterende db.
eksempel kan ses her
http://ekspert.sluk.dk
min kode ser sådan ud min der er fejl i........ ul og li tag ikke sat rigtigt!!!!!!
kode skal være xhtml valid)
Hvor går det galt i koden?
<?
if($_SESSION["auth"] == 1){
$result = mysql_query("SELECT * FROM d_menu_left WHERE parentId = 0 ORDER by sortkey");
}else{
$result = mysql_query("SELECT * FROM d_menu_left WHERE parentId = 0 AND publish = 'YES' ORDER by sortkey");
}
echo "<ul>\n";//yderste ul
while($data = mysql_fetch_array($result)){ //yderste while
echo " <li> <a href='$_SERVER[PHP_SELF]?id=$data[id]'>$data[category_name](id=$data[id]-parentId=$data[parentId])</a>\n";
echo "<ul id=\"unikid-$data[id]\"> \n";
if($_SESSION["auth"] == 1){
$result2 = mysql_query("SELECT * FROM d_menu_left WHERE $data[id] = parentId ORDER by sortkey");
}else{
$result2 = mysql_query("SELECT * FROM d_menu_left WHERE $data[id] = parentId AND publish = 'YES' ORDER by sortkey");
}
while($data2 = mysql_fetch_array($result2)){ //while no1
if($_SESSION["auth"] == 1){
$sqlresult = mysql_query("SELECT * FROM d_menu_left WHERE $data2[id] = parentId ORDER by sortkey");
}else{
$sqlresult = mysql_query("SELECT * FROM d_menu_left WHERE $data2[id] = parentId AND publish = 'YES' ORDER by sortkey");
}
echo "<li><a href='$_SERVER[PHP_SELF]?id=$data2[id]'>$data2[category_name](id=$data2[id]-parentId=$data2[parentId])</a>\n";
echo "</li>\n";
} //while no1
echo "</ul>\n";
}//yderste while
echo "\n</ul>\n\n";//yderste ul
?>