Example #1
0
function phoneFind()
{
    $db = dbConnect();
    //$db->debug=1;
    $phone = htmlentities($_GET['phone'], ENT_QUOTES);
    $query = "select * from myCustomer where phone = '{$phone}'";
    $result = $db->Execute($query);
    if (!$result) {
        print "Error with result";
        return;
    }
    $count = $result->RowCount();
    if ($count == 0) {
        printOrder($phone);
    } else {
        $row = $result->FetchRow();
        $name = $row['name'];
        $customer = $row['customerId'];
        $queryCO = "select * from myCustomerToMyOrder where customerId = '{$customer}'";
        $resultCO = $db->Execute($queryCO);
        $rowCO = $resultCO->FetchRow();
        $order = $rowCO['orderId'];
        $query1 = "Select * from myOrder where orderId='{$order}'";
        $result1 = $db->Execute($query1);
        $row1 = $result1->FetchRow();
        $toppingId = $row1['toppingsId'];
        $sizeId = $row1['sizeId'];
        printOrder($phone, $name, $toppingId, $sizeId);
    }
}
                        <a href="/">Магазин</a>
                        <p>Просмотр заказа</p>
                    </div>
                    <div class="row orders clearfix">
                        <?php 
if (!$flag) {
    echo "Такого заказа не существует";
} else {
    echo "<p class=info>Контактные данные</p>";
    echo "<table class=customer>\n                                        <thead><tr>\n                                            <td>ФИО</td>\n                                            <td>Адрес доставки</td>\n                                            <td>Email</td>\n                                            <td>Примечание</td>\n                                        </tr></thead>";
    echo "<tbody><tr><td>" . $order['customer_name'] . "</td>";
    echo "<td>" . $order['address'] . "</td>";
    echo "<td>" . $order['email'] . "</td>";
    echo "<td>" . $order['addition'] . "</td><tr></tbody></table>";
    echo "<p class=info>Заказанные товары</p>";
    include_once "print_orders.php";
    echo "<table class=products-table>\n                                        <thead><tr>\n                                            <td>Название товара</td>\n                                            <td>Стоимость</td>\n                                            <td>Количество</td>\n                                        </tr></thead>";
    $productsInOrder = \App\DB\OrdersProducts::getProductsInOrder($connection, $order['order_id']);
    OrderTable($productsInOrder, $connection);
    echo "</table>";
    printOrder($order, $connection);
}
?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<?php 
include_once __DIR__ . '/templates/_footer.php';