-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders.php
86 lines (67 loc) · 3.07 KB
/
orders.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
<?php
include 'config.php';
session_start();
$user_id = $_SESSION['user_id'];
if (!isset($user_id)) {
header('Location: login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="EGYBOOK Bookstore is one of the leading book seller in Egypt. Boasting more than 7,000 Arabic and foreign titles and aiming to provide the best book shopping experience." />
<title>EGYBOOK | Orders</title>
<!-- Tab Icon -->
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
<!-- Fontawesome CDN Link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Custom CSS Style File -->
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<?php include 'header.php'; ?>
<div class="heading">
<h3>your orders</h3>
<p><a href="home.php">home</a> / orders</p>
</div>
<section class="placed-orders">
<h1 class="title">placed orders</h1>
<div class="box-container">
<?php
$select_orders = mysqli_query($conn, "SELECT * FROM `orders` WHERE user_id = '$user_id'") or die("Query failed: " . mysqli_connect_error());
if (mysqli_num_rows($select_orders) > 0) {
while ($row = mysqli_fetch_assoc($select_orders)) {
?>
<div class="box">
<p>placed on : <span><?php echo $row['placed_on']; ?></span></p>
<p>name : <span><?php echo $row['name']; ?></span></p>
<p>email : <span><?php echo $row['email']; ?></span></p>
<p>phone : <span><?php echo $row['number']; ?></span></p>
<p>address : <span><?php echo $row['address']; ?></span></p>
<p>payment method : <span><?php echo $row['method']; ?></span></p>
<p>your orders : <span><?php echo $row['total_products']; ?></span></p>
<p>total price : <span>$<?php echo $row['total_price']; ?>/-</span></p>
<p>payment status : <span style="color:<?php if ($row['payment_status'] == 'pending') {
echo 'var(--orange)';
} else {
echo 'green';
} ?>"><?php echo $row['payment_status']; ?></span></p>
</div>
<?php
}
} else {
echo "<p class='empty'>You have no orders placed</p>";
}
?>
</div>
</section>
<?php include 'footer.php'; ?>
<script src="js/main.js"></script>
</body>
</html>