Hi there,
Hopefully some clever lad or ladette can help me figure out the logic for the follwoing code.
I have started to use superfish jquery plugin for my navigation and have got the code working fine and easily with static links, but when I try to change that to dynamic links I am having trouble getting the 2nd level tag to work properly; to only show when 2nd level links are found and then only show once before the 2nd level links are written out from the database.
I hope I have made myself clear with the problem. Appologies if I havn't.
<ul class="sf-menu">
<?php
// A varible that increments on every loop of the below "while" statement
$count == 0;
$result = mysql_query("SELECT * FROM web_navbar_links WHERE link_parent='1' AND visible='1' ORDER BY position ASC");
while ($row = mysql_fetch_object($result)) {
$parentID = $row->id;
$parentLevel = $row->slug;
// Increment the counter varible by one
$count++;
echo "<li";
switch ($parentLevel) {
case "business":
echo " id='business'";
break;
case "education":
echo " id='education'";
break;
case "consumer":
echo " id='consumer'";
break;
}
echo "><a>".ucwords(trim($row->link_name))."</a>";
$result2 = mysql_query("SELECT * FROM web_navbar_links WHERE link_child='1' AND parent_relationID='".$parentID."' AND visible='1' ORDER BY position ASC");
if ($row2 = mysql_fetch_object($result2)) {
echo "<ul>"; //PROBLEM LIES HERE!! ATM THE <UL> WRITES ONCE BUT THE LOOP ONLY READS BACK THE LAST ENTRY FROMT HE db.
while ($row2 = mysql_fetch_object($result2)) {
echo "<li><a href='http://". ROOT . ADMIN . SECTIONS . TEMPLATES . $row2->link_href."?".$row2->slug."=".$row2->slug."' title='".$row2->link_title."'>".$row2->link_name."</a>";
echo "<ul>";
echo "<li><a href='#'>blah</a></li>";
echo "</ul>";
echo "</li>";
}
echo "</ul>";
}
echo "</li>";
if ($count < 3) {
echo "<li class='breaker'></li>";
}
else {
echo "";
}
}
?>
</ul>