-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathorderHistory.php
102 lines (68 loc) · 1.86 KB
/
orderHistory.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
<?php
include_once 'includes/db_connect.php';
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Virtual Eye Shop !</title>
<link rel="stylesheet" type="text/css" href="frontEnd.css">
</head>
<body>
<header>
<img src="img/marvel.png" alt="logo">
</header>
<?php
include('main-menu.php');
include('search-nav.php');
?>
<body>
<style type="text/css">
</style>
<?php
if (isset($_SESSION['name'])) {
$id = $_SESSION['id'];
$name = $email = $phone = $address ="";
$sql = "SELECT * FROM orderProduct WHERE customer_id = $id";
$result = $mysqli->query($sql);
}
?>
<section>
<center>
<caption>Order History</caption>
<?php
if ($result->num_rows > 0) {
?>
<table>
<tr>
<th>Sr.</th>
<th>Item Name </th>
<th>Status</th>
<th>Date</th>
</tr>
<?php
$index=1;
while($row = mysqli_fetch_array($result))
{
$whereIn = $row['item_id'];
$sql2 = "SELECT name FROM product WHERE id IN ($whereIn)";
$result2 = $mysqli->query($sql2);
$name="";
while($row2 = mysqli_fetch_assoc($result2)){
$name.=$row2['name'].", ";
}
echo "<tr>"."<td>".$index++."</td>"."<td>" . $name . "</td>"."<td> " . $row['status']."</td>"."<td> " . $row['created_date']."</td>"."</tr>";
}
?>
</table>
<?php
}
else {
echo "No result found";
}
?>
</center>
</section>
<?php include('footer.php');?>
</body>
</html>