-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancel_order_user.php
54 lines (35 loc) · 1.01 KB
/
cancel_order_user.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
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require_once('database.php');
?>
<?php
if(isset($_GET['order_id']))
{
$id=$_GET['order_id'];
$sql = "SELECT * FROM orders WHERE order_id=$id";
$res = mysqli_query($connect, $sql);
$count = mysqli_num_rows($res);
if($count==1)
{
$row=mysqli_fetch_assoc($res);
$status = $row['status'];
}
}
else{
echo "";
}
?>
<?php
if($status=="Ordered"){
$id = $_GET['order_id'];
$sql = "UPDATE orders
set status = 'Cancelled'
where status= 'Ordered' and order_id=$id";
$record=mysqli_query($connect,$sql);
$_SESSION['update']="Order Cancelled Succesfully";
header('location:manage_order_user.php');
}
else{
$_SESSION['update']="Your Order cannot cancelled right now!";
header('location:manage_order_user.php');
}
?>