php menu help

They have: 9 posts

Joined: Jun 2006

I have a database and I am trying to write a script that will allow me display the three different catagories that are in the database.

html for display menu
Sort by Menu Items
Sort by Menu Type
Sort by Price

PHP for display menu


<?php

// connect to database


$conn = mysql_connect ("localhost","user","somepass")

if  (
DB::isERror($db))  {die("Can't connect: " . $db->getMessage( ));  }

$db->setErrorHandling(PEAR_ERRP_DOE)'

$db->setFetchMode(DB_FETCHMODE_ASSOC):

$menuitems = $db->getAll ('
SELECT menu_item,price  FROM menuitems  ORDER BY price');

$menuitems = $db->getAll ('
SELECT menu_item,type  FROM menuitems  ORDER BY type');

$menuitems = $db->getAll ('
SELECT menu_item,items  FROM menuitems  ORDER BY items');

if  (count($menuitems)  > 0) {

     print '
<ul>';

     foreach  ($menuitems  as  %item)  {

          print "<li> $item[menu_item]  ($item[price])</li>";

          print "<li> $item[menu_item]  ($item[type])</li>";

          print "<li> $item[menu_item]  ($item[items])</li>";

     }

     print '
</ul>';

}  else  {

     print '
No dishes available.';

}

?>
'