Hey everyone, I am attempting to create a simple PHP and MySQL navigation system. Here is my navigation table:
====================
id category title link
====================
I want the navigation to have parent like "Main" and have links that fit that category under it. Basically I have 5 or 6 links under 4 different categories. Here is my current code:
PHP Code:
<?php $sql = "SELECT id, category, title, link FROM navigation ORDER BY category desc"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result);
print "<ul class='nav'> <li><a href='#' class='home'>" . $row['category'] . "</a></li> <div class='boxin'> <a class='active' href='" . $row['link'] . "'>" . $row['title'] . "</a><br /> </div>" ?>
This displays only one category and that one link under the category at a time. So how do I make it show all of the categories and links under the correct parent. I hope I am not being to confusing. Thanks!  .
|