Domain: amberpublishers.in
Server Adress: 86.38.243.169
privdayz.com
<?php
function showRecentBooks()
{
// Connect to the database (assuming you have already set up the connection)
require './admin/include/db.php';
// Fetch the recent books from the database
$query = "SELECT * FROM book_details ORDER BY publishedyear DESC LIMIT 6";
$result = mysqli_query($conn, $query);
// Loop through the fetched results
while ($row = mysqli_fetch_assoc($result)) {
$bookId = $row['id'];
$coverImage = $row['book_cover'];
$bookTitle = $row['title'];
$authorName = $row['author'];
$dataTag = $row['book_tag'];
// Generate the HTML code for each book
echo '<div class="col-6 col-xl-2 col-lg-2 col-md-3 col-sm-3 col-xs-2" data-tag="' . $dataTag . '">';
echo '<div class="card" style="width: 150px;">';
echo '<a href="bookdetails.php?id=' . $bookId . '">';
echo '<img src="assets/img/bookcover/' . $coverImage . '" class="card-img-top" alt="..." style="width: 150px; height: 228px;">';
echo '</a>';
echo '</div>';
echo '<h6><strong>Book: ' . substr($bookTitle, 0, 27) . '...</strong></h6>';
echo '<h6>Author: ' . substr($authorName, 0, 27) . '...</h6>';
echo '</div>';
}
// Close the database connection
mysqli_close($conn);
}
?>
