-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteorder.php
42 lines (25 loc) · 994 Bytes
/
deleteorder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php include("./inc/connection.php") ?>
<?php include("./inc/req_functions.php") ?>
<?php
if (!($_SESSION["usertype"] == "SystemAdmin" || $_SESSION["usertype"] == "operational")) {
header("Location: signin.php?access=false");
}
if (isset($_GET["order_id"])) {
$order_id = $_GET["order_id"];
$query = "SELECT * FROM preorders WHERE order_id='{$order_id}' LIMIT 1";
$result = mysqli_query($conn, $query);
query_check($result);
if (mysqli_num_rows($result) == 1) {
$row = mysqli_fetch_assoc($result);
$order_id = $row['order_id'];
$userid = $row['userid'];
}
$query = "DELETE FROM order_meals WHERE order_id = '{$order_id}'";
$result = mysqli_query($conn, $query);
query_check($result);
$query = "DELETE FROM preorders WHERE order_id = '{$order_id}'";
$result = mysqli_query($conn, $query);
query_check($result);
echo "Deleted Successfull!";
header("Location: manageorders.php?deleted=true");
}