I am making a website of a resturant. in database I have created two tables
1-food(id,food_name,cat_id(F.K),)
2-category(cat_id,cat_name)
I want to display the category in navigation bar and on clicking the category it has to show the respected food that comes under the category.
example I have the following entries in my table
food_name=Zinger Burger,Chicken Burger,Sea Food
cat_name=FastFood,Fish
how can I show the category on menu bar as a hyperlink and on clicking the shows the food from database that is onclicking the fastfood it shows the zinger and chicken burger.
below is my work which I have done so far
?php
$query="Select * from category";
$result=mysql_query($query,$connection);
while($category=mysql_fetch_array($result))
{?>
<ul>
<li>
<?php $category["cat_name"]; <br mode="hold" /?>
echo "<a href="\"show.php\""> ".$category['cat_name'] ." </a>";
}?>
</li>
</ul>
<?php <br mode="hold" /?>
//$food="Select * from food where cat_id={$category["cat_id"]} ";
$query = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE cat_id=" . $category["cat_id"] ." ";
$result1=mysql_query($query,$connection);
while($foodname=mysql_fetch_array($result1))
{
echo"<li> {$foodname["food_name"]}</li>";
}
echo "";
?>