Dear Friends, I have a category table. Category ------------------------ ctegory_id-----parent_id-----category_name 1-----------------0-------------Sports 2-----------------0-------------Music 3-----------------2-------------Rap 4-----------------2-------------Pop 5-----------------4-------------Jackson 6-----------------4-------------Madonna 7-----------------1-------------Maradona I need a navigation bar then ppl can easily understand where is he and can move any catgory any time. Home > Music > Pop > Madonna Please help me. Thanks
I am using following codes for navigation menu <?php if($category_id==""){ $category_id=0; } $c=mysql_query("select * from category where parent_id='$category_id'"); while($cr=mysql_fetch_array($c)){ echo "<a href=index.php?category_id=".$cr["category_id"].">".$cr["category_name"]."</a><br>"; } ?>
You will have to get child categories of a category recursively. Use a function instead of writing and executing query in mid of code.