Hello,
Great website you have here 🙂
I am making a menu administration panel for a restaurant and storing the contents of the menu in a database. I have the following tables:
menu
menu_cat
menu_item
What I'm trying to do is basicly make it look like a regular menu, You have the categories and under each category there will be menu items. like so:
Breakfast
eggs ----- 3.00
toast ----- 3.00
frenchtoast ----3.00
Lunch
sandwich ----- 3.00
something ----- 3.00
hotdog ----3.00
Dinner
ham ----- 3.00
steak----- 3.00
fish ----3.00
But right now the way I have it its not getting categorized, its display like so:
http://bluewaterinn.dlgresults.com/menu.php?menu=4
which is giving me the catname with each item name and not putting all the same items under one category. I know my code is wrong but im unsure of a way to approach this. Here is the current code I am using to display what I have, Any help would be greatly appreciated. Thanks!
<?php
if (isset($menu)) {
$query2 = $database->query("SELECT * FROM menu_cat WHERE menu = '$menu'");
while ($list2 = mysql_fetch_array($query2)) {
$catid = stripslashes($list2['id']);
$catname = stripslashes($list2['name']);
$catmenu = stripslashes($list2['menu']);
$description = stripslashes($list2['description']);
$cats .= '<h1>'.$catname.'</h1>
<p><em>'.$description .'</em></p>';
$query3 = $database->query("SELECT * FROM menu_item WHERE menu = '$menu' and cat = '$catid'");
while ($list3 = mysql_fetch_array($query3)) {
$itemid = stripslashes($list3['id']);
$itemname = stripslashes($list3['name']);
$itemmenu = stripslashes($list3['menu']);
$itemdescription = stripslashes($list3['description']);
$itemprice = stripslashes($list3['price']);
$itemfeature = stripslashes($list3['feature']);
$itemcat = stripslashes($list3['cat']);
$items = '<h1>'.$itemname.'</h1>
<p>'.$itemdescription.'</p>
<p>'.$itemprice.'</p>';
$parsecat .= '<h1>'.$catname.'</h1>
'.$items.'';
}
}
echo $parsecat ;
}else {
echo $menus;
}
?>