-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete_order.php
More file actions
52 lines (44 loc) · 1.08 KB
/
Copy pathdelete_order.php
File metadata and controls
52 lines (44 loc) · 1.08 KB
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
43
44
45
46
47
48
49
50
51
52
<?php
include "dbConfig.php";
session_start();
if (!isset($_SESSION['userId'])) {
header("Location: login.php");
exit();
}
function deleteOrder(){
$conn = connectToDB();
$orderId = $_GET['orderId'];
$success = true;
deleteProductCheckout($orderId);
if ($success){
$sql = "DELETE FROM checkout_details WHERE orderId='$orderId'";
$conn->query($sql);
if ($success){
header("Location: orders.php");
}else{
echo "Error in deleting";
}
}else{
$sql = "DELETE FROM checkout_details WHERE orderId='$orderId'";
$conn->query($sql);
if ($success){
header("Location: orders.php");
}else{
echo "Error in deleting";
}
}
}
function deleteProductCheckout($orderId){
$success = true;
$conn = connectToDB();
$sql = "DELETE FROM product_checkout WHERE checkout_details_orderId='$orderId'";
$conn->query($sql);
if($success){
return $success;
}else{
$success = false;
return $success;
}
}
deleteOrder();
?>