-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.php
More file actions
94 lines (82 loc) · 3.82 KB
/
order.php
File metadata and controls
94 lines (82 loc) · 3.82 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
<?php
include 'components/connection.php';
session_start();
if (isset($_SESSION['user_id'])) {
$user_id = $_SESSION['user_id'];
} else {
$user_id = '';
}
if (isset($_POST['layout'])) {
session_destroy();
header("location:login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="style.css">
<title>MyWebsite - order </title>
</head>
<body>
<?php include './components/header.php'; ?>
<div class="main">
<div class="banner">
<h1>my order</h1>
</div>
<div class="title2">
<a href="home.php">home</a><span>/ order</span>
</div>
<section class="orders">
<div class="title">
<img src="img/download.png" class="logo" alt="">
<h1>my order</h1>
<p>Pay for order your products.</p>
</div>
<div class="box-container">
<?php
$select_order = $conn->prepare("SELECT * FROM `orders` WHERE user_id=?");
$select_order->execute([$user_id]);
if ($select_order->rowCount() > 0) {
while ($fetch_order = $select_order->fetch(PDO::FETCH_ASSOC)) {
$select_products = $conn->prepare("SELECT * FROM `products` WHERE id=?");
$select_products->execute([$fetch_order['product_id']]);
if ($select_products->rowCount() > 0) {
while ($fetch_product = $select_products->fetch(PDO::FETCH_ASSOC)) {
?>
<div class="box" <?php if ($fetch_order['status']) {
echo 'style="border:2px solid red";';
} ?>>
<a href="view_order.php?get_id=<?= $fetch_order['id'] ?>">
<p class="date"><i class="bi bi-calender-fill"></i><span><?= $fetch_order['date'] ?></span></p>
<img src="image/<?= $fetch_product['image'] ?>" class="image" alt="">
<div class="row">
<h3 class="name"><?= $fetch_product['name'] ?></h3>
<p class="price">Price: $<?= $fetch_order['price'] ?> x <?= $fetch_order['qty'] ?></p>
<p class="status" style="color: <?php if ($fetch_order['status'] == 'delivered') {
echo 'green';
} elseif ($fetch_order['status'] == 'canceled') {
echo 'red';
} else {
echo 'orange';
} ?>;"></p>
</div>
</a>
</div>
<?php
}
}
}
}
?>
</div>
</section>
<?php include 'components/footer.php'; ?>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script src="script.js"></script>
<?php include './components/alert.php'; ?>
</body>
</html>