-
Notifications
You must be signed in to change notification settings - Fork 1
/
orders.php
45 lines (45 loc) · 1.6 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
<?php
session_start();
$title = "Your Orders";
require_once "functions/database_functions.php";
require "./template/menu.php";
if(isset($_SESSION['id'])) {
$result = getAllOrdersOfACustomer($_SESSION['id']);
// echo mysqli_num_rows($result);
//$orders = mysqli_fetch_assoc($result);
if ($result!=null) {
$rows = mysqli_num_rows($result);
if($rows>0){
?>
<h1>My Orders</h1>
<table class="table">
<tr>
<th>Order Id</th>
<th>Date</th>
<th>Book Title</th>
<th>Book Price</th>
</tr>
<?php
while($order = mysqli_fetch_assoc($result)){
?>
<tr>
<td><?php echo $order['orderid']?></td>
<td><?php echo $order['date']?></td>
<td><?php echo $order['book_title']?></td>
<td><?php echo $order['book_price']?></td>
</tr>
<?php } ?>
</table>
<?php
} else {
echo"<span style='color:red'>You have not ordered any book yet!</span>";
}
}else {
echo "<p class=\"text-warning\">Your cart is empty! Please make sure you add some books in it!</p>";
}
} else {
header('Location:login.php');
}
if(isset($conn)){ mysqli_close($conn); }
//require_once "./template/footer.php";
?>