-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_order_user.php
119 lines (97 loc) · 4.9 KB
/
manage_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
require_once('database.php');
require_once('userpanel.php');
?>
<div class="main-content">
<div class="wrapper">
<h1 class="titledashboard">Manage Order</h1>
<br /><br /><br />
<?php
if(isset($_SESSION['update']))
{
echo "<p style='text-align:center;color:green; margin-left:20px;'>";
echo $_SESSION['update'];
unset($_SESSION['update']);
echo "</p>";
}
?>
<br><br>
<table class="tbl-full">
<tr>
<th>Order ID</th>
<th>Food</th>
<th>Qty.</th>
<th>Total</th>
<th>Order Date</th>
<th>Contact</th>
<th>Address</th>
<th>Status</th>
<th>Actions</th>
</tr>
<?php
$id=$_SESSION['customer_id'];
$sql = "SELECT order_id,food.food_name,quantity,total_price,order_date,
customer.contact_number,address,status from orders,food,customer
where orders.customer_id=customer.customer_id and orders.food_id=food.food_id and customer.customer_id='$id'
ORDER BY order_id DESC";
$res = mysqli_query($connect, $sql);
$count = mysqli_num_rows($res);
if($count>0)
{
while($row=mysqli_fetch_assoc($res))
{
$id = $row['order_id'];
$food = $row['food_name'];
$qty = $row['quantity'];
$total = $row['total_price'];
$order_date = $row['order_date'];
$customer_contact = $row['contact_number'];
$customer_address = $row['address'];
$status = $row['status'];
?>
<tr>
<td><?php echo $id; ?>. </td>
<td><?php echo $food; ?></td>
<td><?php echo $qty; ?></td>
<td><?php echo $total; ?></td>
<td><?php echo $order_date; ?></td>
<td><?php echo $customer_contact; ?></td>
<td><?php echo $customer_address; ?></td>
<td>
<?php
if($status=="Ordered")
{
echo "<label>$status</label>";
}
elseif($status=="On Delivery")
{
echo "<label style='color: orange;'>$status</label>";
}
elseif($status=="Delivered")
{
echo "<label style='color: green;'>$status</label>";
}
elseif($status=="Cancelled")
{
echo "<label style='color: red;'>$status</label>";
}
?>
</td>
<td>
<a href="<?php echo ""; ?>cancel_order_user.php?order_id=<?php echo $id; ?>" class="btn-secondary">Cancel Order</a>
</td>
</tr>
<?php
}
}
else
{
echo "<tr><td colspan='12' class='error'>No Orders Available</td></tr>";
}
?>
</table>
</div>
</div>
<?php
require_once('footers.php');
?>