本文整理汇总了PHP中Orders::getOrders方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::getOrders方法的具体用法?PHP Orders::getOrders怎么用?PHP Orders::getOrders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orders
的用法示例。
在下文中一共展示了Orders::getOrders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Orders
header("Content-Type: text/event-stream");
header("Cache-Control: no-cache");
// header('retry: 1000');
require_once "DbConnection.php";
require_once "../models/Orders.php";
session_start();
if (!isset($_SESSION['rows'])) {
$_SESSION['rows'] = 0;
}
var_dump($_SESSION);
$tblRows = $_SESSION['rows'];
$dbConnection = DbConnection::getConnection();
$orderInterface = new Orders($dbConnection);
$dbRowSet = $dbConnection->query("SELECT count(*) as count from orders");
$resultArr = $dbRowSet->fetch_assoc();
// $resultArr = json_encode($resultArr);
// echo "data: {$resultArr}\n\n";
if ($tblRows != 0 && $tblRows < $resultArr['count']) {
$_SESSION['rows'] = $resultArr['count'];
$ordersSet = $orderInterface->getOrders("and status != 'canceled' order by date,time desc limit 1");
$order = $ordersSet->fetch_assoc();
$response = array();
$response['response'] = $order;
$response = json_encode($response);
echo "data: {$response}\n\n";
ob_end_flush();
flush();
} else {
$_SESSION['rows'] = $resultArr['count'];
}
示例2: Orders
<?php
require_once "DbConnection.php";
require_once "../models/Orders.php";
session_start();
$orderInterface = new Orders(DbConnection::getConnection());
if (isset($_POST['dest'])) {
switch ($_POST['dest']) {
case 'cancelOrder':
$orderInterface->setOrderStatus('canceled', $_POST['msg']);
break;
case 'getOrders':
$ordersRowSet = $orderInterface->getOrders("and status = 'proccessing' order by date,time");
$orders = array();
while ($order = $ordersRowSet->fetch_assoc()) {
array_push($orders, $order);
}
echo json_encode($orders);
break;
case 'getOrderDetails':
$ordersRowSet = $orderInterface->getOrderDetails($_POST['oId']);
$orders = array();
while ($order = $ordersRowSet->fetch_assoc()) {
array_push($orders, $order);
}
echo json_encode($orders);
break;
case 'deliver':
$orderInterface->setOrderStatus('Out for delivery', $_POST['oId']);
$dbConnection = DbConnection::getConnection();
$dbConnection->query("CREATE EVENT updateStatus" . $_POST['oId'] . "\n ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE DO\n UPDATE orders SET status = 'Done' WHERE o_id = " . $_POST['oId'] . ";");