本文整理汇总了PHP中Restaurant::multipleFind方法的典型用法代码示例。如果您正苦于以下问题:PHP Restaurant::multipleFind方法的具体用法?PHP Restaurant::multipleFind怎么用?PHP Restaurant::multipleFind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Restaurant
的用法示例。
在下文中一共展示了Restaurant::multipleFind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Session
<?php
require_once 'model/session.php';
require_once 'model/restaurant.php';
require_once 'model/order.php';
$session = new Session();
$order = new Order();
$restaurant = new Restaurant();
$user_id = $session->get_session_data('id');
$restaurants = $restaurant->multipleFind('owner_id', $user_id);
$size = sizeof($restaurants);
$restaurant_ids = [];
$count = 1;
$arr = "(";
foreach ($restaurants as $key => $value) {
if ($count == $size) {
$arr .= $value['id'];
} else {
$arr .= $value['id'] . ",";
}
$count += 1;
}
$result = $order->execSQL('SELECT *,`order`.`id` as `orderId`,`order`.`status` as `orderStatus` FROM `order` INNER JOIN `users` ON `users`.`id` = `order`.`user_id` INNER JOIN `restaurant` ON `restaurant`.`id` = `order`.`restaurant_id` INNER JOIN `credit_cards` ON `credit_cards`.`id` = `order`.`card_id` INNER JOIN `delivery_address` ON `delivery_address`.`id` = `order`.`address_id` WHERE `order`.`restaurant_id` IN ' . $arr . ');');
$data = [];
while ($row = mysqli_fetch_object($result)) {
array_push($data, (array) $row);
}
?>
<!DOCTYPE html>
<html lang="en">
示例2: Restaurant
?>
<div class="container" style="margin-top:100px;margin-bottom:50px;min-height: 500px;">
<?php
if ($session->session_exist('user_type')) {
?>
<?php
if ($session->get_session_data('user_type') == 'restaurant_owner') {
?>
<h1>Your Restaurants</h1>
<a href="new_restaurant.php" class="btn btn-warning" style="float:right;margin-top:-40px"><i class="fa fa-plus"></i> Add new restaurant</a>
<div>
<div class="col-sm-8">
<?php
$restaurant = new Restaurant();
$data = $restaurant->multipleFind('owner_id', $session->get_session_data('id'));
// var_dump($data);
foreach ($data as $key => $value) {
echo '<div class="row" restaurant-id="' . $value['id'] . '">
<div class="col-sm-2">
<a href="/view-restaurant.php?id=' . $value['id'] . '"><img src=".' . $value['image'] . '" height="90px" width="90px"></a>
</div>
<div class="col-sm-6">
<a href="/view-restaurant.php?id=' . $value['id'] . '"><h4>' . ($key + 1) . '. ' . $value['name'] . '</h4></a>
<h4>' . $value['rating'] . ' star rating ' . $value['review_count'] . ' reviews</h4>';
switch ((int) $value['status']) {
case 1:
echo '<span class="label label-success">Approved</span>';
break;
case 2:
echo '<span class="label label-warning">Blocked</span>';