i want to put my menu into a mysql database.
i have a table like this:
fb_menu (id, name, main_category, level, status)
you can see a static version here:
[url]http://www.morganwaage.com/fb/sub.php?menu=re&cat=re_main
and the database version here:
[url]http://www.morganwaage.com/fb/sub2.php?menu=re&cat=re_main
the difference is in the “Om forbrukerguiden” button. when you hover over it, it is suposed to give you two level2 buttons… but it is not working…
can anyone see in the code below what i am doing wrong???
[code=php]
$sql = “SELECT * FROM fb_menu WHERE status = ‘active’ AND main_category = ‘re’;”;
$result = mysql_query($sql, $conn);
echo “<ul class=’level1′>n”;
while ($row = mysql_fetch_array($result) ) {
$id = $row[‘id’];
$name = $row[‘name’];
$main_category = $row[‘main_category’];
$level = $row[‘level’];
$status = $row[‘status’];
if($level == 1 || $level == 0){
if($level == 1){
echo “<li><a href=’#’>” . $name . “</a></li>n”;
}
elseif($level == 0){
echo “<li class=’submenu’><a href=’#’>” . $name . “</a>n”;
echo “<ul class=’level2′>”;
echo “<li><a href=’#’>” . $name . “</a></li>n”;
echo “</ul>”;
echo “</li>”;
}
}
}
this is the static html that i am trying to generate:
[code=html]
<ul class=”level1″>
<li><a href=”#”>Kraf før reisen</a></li>
<li><a href=”#”>Krav etter reisen</a></li>
<li><a href=”#”>Reklamasjon</a></li>
<li><a href=””>Avbestilling</a></li>
<li class=”submenu”><a href=”#”>Om forbrukerguiden</a>
<ul class=”level2″>
<li><a href=”#”>Generelt</a></li>
<li><a href=”#”>Ta kontakt</a></li>
</ul>
</li>
<li><a href=”#”>Nyttige lenker</a></li>
</ul>