-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooks.php
48 lines (46 loc) · 1.36 KB
/
books.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
<?php
session_start();
$count = 0;
// connecto database
require_once "./functions/database_functions.php";
$conn = db_connect();
$query = "SELECT book_isbn, book_image FROM books";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
$title = "Full Catalogs of Books";
require_once "./template/header.php";
?>
<p class="lead text-center text-muted" style="text-transform: uppercase;
margin-bottom: 30px;
color: black;
font-size: 30px;">ALL PRODUCTS</p>
<span class="border" style="display: block;
margin: auto;
width: 160px;
height: 3px;
background: #3498db;
margin-bottom: 40px;"></span>
<?php for($i = 0; $i < mysqli_num_rows($result); $i++){ ?>
<div class="row">
<?php while($query_row = mysqli_fetch_assoc($result)){ ?>
<div class="col-md-3">
<a href="book.php?bookisbn=<?php echo $query_row['book_isbn']; ?>">
<img class="img-responsive img-thumbnail" src="./bootstrap/img/<?php echo $query_row['book_image']; ?>">
</a>
</div>
<?php
$count++;
if($count >= 4){
$count = 0;
break;
}
} ?>
</div>
<?php
}
if(isset($conn)) { mysqli_close($conn); }
require_once "./template/footer.php";
?>