-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewOrder.php
125 lines (105 loc) · 2.81 KB
/
viewOrder.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
session_start();
$err="";
if(!isset($_SESSION['user'])){
header("location:/login.php");
}elseif($_SESSION['user']['admin'] == false){
$err .= "Admin login needed";
}elseif(isset($_GET['ord'])){
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="Master.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order</title>
</head>
<body>
<style>
P{
color: white;
}
h3{
color: white;
}
.orderinfo{
width: 30%;
float: right;
}
.prod{
width: 70%;
display: flex;
flex-direction: column;
}
.ordcard{
max-height: 33%;
display: flex;
flex-direction: row;
justify-content: space-around;
}
.ordcard img{
max-width: 15%;
padding: 10px;
border: 2px solid;
margin: 20px;
}
</style>
<?php
require("header.php");
echo "<main>
<div class='back-vieworders'>";
try{
require("connection.php");
$stmt = $db->prepare("SELECT * FROM orders JOIN users ON users.user_ID = orders.user_ID WHERE order_ID = ?");
$stmt->execute(array($_GET['ord']));
if($row = $stmt->fetch()){
echo '
<div class="orderinfo">
<p><b>Order Number: </b>'.$row['order_ID'].'</p>
<p><b>Customer Name: </b>'.$row['name'].'</p>
<p><b>Customer Contact : </b>'.$row['phone'].'</p>
<p><b>Order Date: </b>'.$row['date'].'</p>
<p><b>Total price: </b>'.$row['total_price'].'</p>
<fieldset>
<p> <legend><b>Customer Address</b></legend>
Block: '.$row['block'].' <br>
Street: '.$row['street'].' <br>
Home: '.$row['home'].' <br></p>
</fieldset>
</div>
';
$prod = $db->prepare("SELECT * FROM orderDets WHERE order_ID = ?");
$prod->execute(array($_GET['ord']));
$det = $db->prepare("SELECT * FROM products WHERE PID = :pid");
$det->bindParam(":pid",$pid);
echo '<div class="prod">';
while($data = $prod->fetch()){
$pid = $data['PID'];
$det->execute();
if($pd = $det->fetch()){
echo '
<div class="ordcard">
<img src="'. $pd['image'] .'">
<div class="text">
<h3 class="card-title">'. $pd['name'] .'</h3>
<p>'. $pd['price'] .' BD</p>
</div>
</div>';
}
}
echo '</div>';
}
}catch(PDOException $e){
$err .= $e;
}
?>
</div>
</main>
</body>
</html>
<?php
}
echo $err;
?>