This repository was archived by the owner on Mar 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_arrivals.php
More file actions
48 lines (46 loc) · 1.9 KB
/
new_arrivals.php
File metadata and controls
48 lines (46 loc) · 1.9 KB
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
include 'includes/db.php'; // Root files use this path
include_once 'includes/functions.php'; // Safely load e()
/** @var mysqli $conn * */
// Fetch the 8 most recently added books
$query = "SELECT title, author, image, status FROM books ORDER BY id DESC LIMIT 8";
$result = $conn->query($query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>New Arrivals | Library</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<style>
body { background-color: #f8f9fa; }
.book-card { transition: transform 0.2s; border: none; border-radius: 15px; }
.book-card:hover { transform: translateY(-5px); }
.book-img { height: 250px; object-fit: cover; border-radius: 15px 15px 0 0; }
.badge-available { background-color: #28a745; }
</style>
</head>
<body>
<div class="container py-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="fw-bold text-success">New Arrivals</h2>
<a href="Home.php" class="btn btn-outline-secondary">Back to Home</a>
</div>
<div class="row row-cols-1 row-cols-md-4 g-4">
<?php while($book = $result->fetch_assoc()): ?>
<div class="col">
<div class="card h-100 book-card shadow-sm">
<img src="image/<?php echo e($book['image']); ?>" class="card-img-top book-img"
onerror="this.src='image/default_book.png'" alt="">
<div class="card-body">
<h5 class="card-title fw-bold"><?php echo e($book['title']); ?></h5>
<p class="card-text text-muted small">by <?php echo e($book['author']); ?></p>
<span class="badge badge-available"><?php echo e($book['status']); ?></span>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</body>
</html>