menu help
Posted: Mon Jul 17, 2006 5:40 pm
Pimptastic | Please use
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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.
dont know if this code is rite
html for display menu
Sort by Menu Items
Sort by Menu Type
Sort by PriceCode: Select all
<?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.';
}
?>Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]