Restaurant menu

Restaurant menu

am 22.07.2006 04:40:52 von Craig Hoffman

Hey there,
I'm working on a menu system for a catering company. I'm having a
difficult time sorting and grouping items together. For example,
there may be three or four appetizers that should be group together.
But I only want to display the category (appetizers) once and then
the corresponding items (A, B, C,...). I'm drawing a blank on how to
go about this.

My DB consists of 4 tables (categories, items, item_attributes,
menu) but the menu table is most the important. The menu schema is
below.

menu_id
menu_name
menu_category => pulls from the categories table (appetizers,
starters, etc...)
menu_item => pulls from the items table (Cherry Pie)
menu_item_atttribute => pulls from the attribute table (Hot, cold, etc)

Example:
Menu Name: xxxxx
Appetizers
A
B
C
D

Desserts
A
B

I'm open to all suggestions / ideas.
Thanks
- Craig

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Restaurant menu

am 22.07.2006 15:02:14 von Bastien Koert

Order the query by the category, when the category changes echo out the new
category like a heading

....

echo "

";
$old_cat = '';

while ($rows = mysql_fetch_array($result))
{

if ($rows['cat'] != $old_cat)
{
echo "";
echo "";
$old_cat = $rows['cat'];

}

echo "
". rows['item'];
}


Bastien
>From: Craig Hoffman
>To: PHP List
>Subject: [PHP-DB] Restaurant menu
>Date: Fri, 21 Jul 2006 21:40:52 -0500
>
>Hey there,
>I'm working on a menu system for a catering company. I'm having a
>difficult time sorting and grouping items together. For example, there
>may be three or four appetizers that should be group together. But I only
>want to display the category (appetizers) once and then the corresponding
>items (A, B, C,...). I'm drawing a blank on how to go about this.
>
>My DB consists of 4 tables (categories, items, item_attributes, menu) but
>the menu table is most the important. The menu schema is below.
>
>menu_id
>menu_name
>menu_category => pulls from the categories table (appetizers, starters,
>etc...)
>menu_item => pulls from the items table (Cherry Pie)
>menu_item_atttribute => pulls from the attribute table (Hot, cold, etc)
>
>Example:
>Menu Name: xxxxx
>Appetizers
> A
> B
> C
> D
>
>Desserts
> A
> B
>
>I'm open to all suggestions / ideas.
>Thanks
>- Craig
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

" . $rows['cat'] . "