-
Notifications
You must be signed in to change notification settings - Fork 1
/
book_sort.php
62 lines (58 loc) · 2.56 KB
/
book_sort.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
<?php
session_start();
require_once "./functions/database_functions.php";
//connect to the database
$conn = db_connect();
if($_GET['keyword']){
$keyword = $_GET['keyword'];
$row = getBookByKeyword($conn, $keyword);
}
else if($_GET['category']){
$category = $_GET['category'];
$row = getBookByCategory($conn, $category);
}
else if($_GET['author']){
$author = $_GET['author'];
//$row = getBookByAuthor($conn, $author);
}
else if($_GET['publisher']){
$publisher = $_GET['publisher'];
//$row = getBookByPublisher($conn, $publisher);
}
require "./template/header.php";
?>
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800"><a href="index.php">EBFA Bookstore</a> >
<?php if($_GET['keyword'])
echo "Keyword > ", $keyword;
else if($_GET['category']){
echo "Category > ", $category;
}
else if($_GET['author']){
echo "Author > ", $author;
}
else if($_GET['publisher']){
echo "Publisher > ", $publisher;
}
?>
</h1>
</div>
<div class="row">
<?php foreach($row as $book) { ?>
<div class="col-xl-3 col-md-6 mb-4" type="button">
<div class="card shadow mb-4">
<div class="card-body">
<a href="book.php?ISBN=<?php echo $book['ISBN']; ?>" class="text-decoration-none">
<h6 class="m-0 font-weight-bold text-primary"><?php echo $book['Title']; ?></h6>
</a>
<p class="m-0 font-weight-bold"> $ <?php echo $book['Price']; ?> </p>
<p class="m-0 small text-gray-500"> <?php echo $book['Publisher']; ?> </p>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
require "./template/footer.php";
?>