-
Notifications
You must be signed in to change notification settings - Fork 1
/
history.php
103 lines (83 loc) · 3.09 KB
/
history.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
<?php include('partials-front/menu.php'); ?>
<section class="food-menu">
<div class="container">
<h3 class="text-center b">Previous Orders</h3>
<br><br><br>
<style>
table,
td,
th {
border: 1px solid #ddd;
text-align: left;
}
table {
border-collapse: collapse;
width: 100%;
}
th,
td {
padding: 15px;
}
</style>
<table>
<tr>
<th>S.No</th>
<th>Product</th>
<th>Image</th>
<th>Dietary Restrictions</th>
<th>Price</th>
<th>Quantity</th>
<th>Total Price</th>
</tr>
<?php
$customer_id = $_SESSION['cust1'];
if (!$customer_id) {
$customer_id = $_SESSION['cust2'];
}
//Query to Get all CAtegories from Database
$sql = "SELECT * FROM tbl_cart WHERE customer_id=$customer_id and cart_status='inactive'";
//Execute Query
$res = mysqli_query($conn, $sql);
//Count Rows
$count = mysqli_num_rows($res);
//Create Serial Number Variable and assign value as 1
$sn = 1;
//Check whether we have data in database or not
if ($count > 0) {
//We have data in database
//get the data and display
while ($row = mysqli_fetch_assoc($res)) {
$name = $row['product_name'];
$price = $row['product_price'];
$image = $row['product_image'];
$quantity = $row['product_quantity'];
$diet = $row['diet'];
$tprice = $row['product_totalprice'];
?>
<tr>
<td><?php echo $sn++; ?>. </td>
<td><?php echo $name; ?></td>
<td>
<?php
//Check whether image name is available or not
if ($image != "") {
//Display the Image
//echo $image;
?>
<img src="<?php echo SITEURL; ?>images/food/<?php echo $image; ?>" class="img-responsive img-curve card-image">
<?php
} else {
//DIsplay the MEssage
echo "<div class='error'>Image not Added.</div>";
}
?>
</td>
<td><?php echo $diet; ?></td>
<td><?php echo $price; ?></td>
<td><?php echo $quantity; ?></td>
<td><?php echo $tprice; ?></td>
</tr>
<?php
}
}
?>