-
Notifications
You must be signed in to change notification settings - Fork 0
/
favourite.php
78 lines (69 loc) · 2.2 KB
/
favourite.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
<?php include "components/footer.php" ?>
<?php include "components/navbar.php" ?>
<?php include "components/book.php" ?>
<?php
//if user is not signed in
if(!isSigned()){
header("Location: signin.php");
}
//get user email
$email = getSignedEmail();
//get all favourite books of the user
$books = execute("SELECT isbn FROM favourite_books WHERE email=\"$email\"");
function displayFavouriteBooks(){
global $books;
foreach ($books as $book) {
book($book["isbn"], 3);
}
}
?>
<!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">
<!-- custom css -->
<link rel="stylesheet" href="css/orders.css">
<title>BookBae | Favourites</title>
<style>
.no-link{
text-decoration: none;
color: black;
}
.bottom-section{
border-radius: 20px;
background-color: #87574b10;
}
</style>
</head>
<body>
<!-- Navbar starts -->
<?php navbar(""); ?>
<!-- Navbar ends -->
<!-- Page content starts -->
<!-- when invalid order id -->
<div class="container my-3">
<div class="row">
<div class="col">
<h2>Favourite books</h2>
<div class="hr mb-3"></div>
</div>
<div class="col-auto d-flex align-items-center d-none d-md-block">
<a href="search.php?q=" class="btn bg-brown text-white"><i class="bi bi-arrow-left"></i> <strong>Continue shopping</strong></a>
</div>
<div class="text-center my-5 <?php echo $books->num_rows!=0?"d-none":""; ?>">
<h1>No favourite items...!</h1>
</div>
</div>
<div class="row <?php echo $books->num_rows==0?"d-none":""; ?>">
<?php displayFavouriteBooks(); ?>
</div>
</div>
<!-- Page content ends -->
<!-- Footer starts -->
<?php footer(); ?>
<!-- Footer ends -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>