本文整理汇总了PHP中Food::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Food::setId方法的具体用法?PHP Food::setId怎么用?PHP Food::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::setId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFoodById
public static function getFoodById($id)
{
self::$db = Database::getDB();
$query = "select * from food where Food_id='{$id}'";
$result = self::$db->query($query);
$item = $result->fetch();
$food = new Food($item["Food_Catagory"], $item["Food_Price"], $item["Food_Instock"], $item["Food_description"], $item["Food_mark"], $item["Food_Name"], $item["Food_Image"], $item["Discount_price"], $item["Viewed_times"], $item["Sales_volume"]);
$food->setId($item["Food_id"]);
return $food;
}
示例2: getfood
public static function getfood($food_id)
{
global $db;
$query = "SELECT * FROM foods WHERE foodID = {$food_id}";
$result = $db->query($query);
$row = $result->fetch();
$category = CategoryRepository::getCategory($row['categoryID']);
$food = new Food($row['calories'], $row['foodTitle'], $row['foodPrice'], $category);
$food->setId($row['foodID']);
return $food;
}
示例3: Page
public static function Page($array)
{
$log_user = Tool::getLoginUser();
if ($array[0] == CREATE) {
header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . CREATE);
} elseif ($array[0] == EDIT) {
$food = new Food();
$food->setId($_GET['id']);
$food->readDatabase();
SessionHandlers::saveSession($user, 'edit_food');
header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . EDIT);
} elseif ($array[0] == SHOWHIDE) {
header("Location:../?menu=" . PAGE_FOOD . "&cache=" . $_GET['cache']);
} elseif ($array[0] == REFRESH) {
header("Location:../?menu=" . PAGE_FOOD);
} elseif ($array[0] == FRAME) {
$food = new Food();
//print_r($food->readDatabaseAll ());
SessionHandlers::saveSession($food->readDatabaseAll(), 'foodList');
header("Location:../?menu=" . PAGE_FOOD . "&" . VIEW . "=" . FRAME);
} else {
echo "page not found";
}
exit;
}