-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorders.php
More file actions
107 lines (96 loc) · 2.86 KB
/
orders.php
File metadata and controls
107 lines (96 loc) · 2.86 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order History</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #f9f9f9;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
table th,
table td {
padding: 8px;
border-bottom: 1px solid #ddd;
text-align: left;
}
table th {
background-color: #f2f2f2;
}
.btn {
background-color: #6ea8ff;
color: #fff;
padding: 8px 16px;
border: none;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
}
.btn:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Order History</h1>
<table>
<thead>
<tr>
<th>Transaction ID</th>
<th>Buyer ID</th>
<th>Name</th>
<th>Email</th>
<th>City</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
<?php
session_start();
// Fetch data from the transaction table and display it in rows
require 'db.php';
$bid=$_SESSION['id'];
$sql = "SELECT * FROM `transaction` WHERE `bid`='$bid'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['tid'] . "</td>";
echo "<td>" . $row['bid'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['total_price'] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='6'>No orders found</td></tr>";
}
$conn->close();
?>
</tbody>
</table>
<a href="./Login/profile.php" class="btn">Back to Home</a>
</div>
</body>
</html>