D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
Filename :
books.php
back
Copy
<?php // Include your config.php and establish a database connection here include 'config.php'; // Number of items per page $itemsPerPage = 15; // Count the total number of records in the table $countSql = "SELECT COUNT(*) AS total FROM pdf_books"; $countResult = $conn->query($countSql); $row = $countResult->fetch_assoc(); $totalItems = $row['total']; // Calculate the total number of pages $totalPages = ceil($totalItems / $itemsPerPage); // Get the current page from the URL $currentPage = isset($_GET['page']) ? $_GET['page'] : 1; // Calculate the offset for the SQL query $offset = ($currentPage - 1) * $itemsPerPage; // Modify your SQL query to retrieve data with proper pagination $sql = "SELECT * FROM pdf_books ORDER BY upload_date DESC LIMIT $offset, $itemsPerPage"; $result = $conn->query($sql); ?> <!DOCTYPE html> <html lang="en"> <head> <head> <meta charset="utf-8"> <title>index.php Bazm-e-Asar</title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="" name="keywords"> <meta content="" name="description"> <!-- Favicon --> <link rel="icon" type="image/x-icon" href="/img/mic.png"> <!-- Google Web Fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Barlow:wght@600;700&family=Ubuntu:wght@400;500&display=swap" rel="stylesheet"> <!-- Icon Font Stylesheet --> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet"> <!-- Libraries Stylesheet --> <link href="lib/animate/animate.min.css" rel="stylesheet"> <link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"> <link href="lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" /> <!-- Customized Bootstrap Stylesheet --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Template Stylesheet --> <link href="css/style.css" rel="stylesheet"> <link href="css/home.css" rel="stylesheet"> <style> table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px; } tr:nth-child(even) { background-color: #dddddd; } </style> </head> </head> <body> <!-- Add your header content here --> <!-- ... --> <a href="index.php">Main page</a> <div class="container"> <div class="row"> <div class="col-md-4 marquee-container"> <div class="gallery-iteam"> <?php if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { // Your code to display PDF items goes here echo '<div class="pdf-item">'; echo '<a href="pdf_download.php?file=' . $row['pdf_filename'] . '"><img class="thumbnail" src="admin/uploads/pdf/title_covers/' . $row['title_cover'] . '" alt="Title Cover"></a>'; echo '<div class="pdf-details">'; echo '<p><strong>Name:</strong> ' . $row['book_name'] . '</p>'; echo '<p><strong>Author:</strong> ' . $row['book_author'] . '</p>'; echo '<h3><center> <a href="pdf_download.php?file=' . $row['pdf_filename'] . '"><i class="fa fa-download"></i> Download</a></center></h3>'; echo '<p><strong>Details:</strong> ' . $row['description'] . '</p>'; echo '</div>'; echo '</div>'; } } else { echo '<p>No PDFs found in the database.</p>'; } ?> </div> </div> <!-- Bootstrap Pagination --> <nav aria-label="Page navigation example"> <ul class="pagination"> <?php // Generate pagination links for ($i = 1; $i <= $totalPages; $i++) { echo '<li class="page-item' . ($i == $currentPage ? ' active' : '') . '"><a class="page-link" href="?page=' . $i . '">' . $i . '</a></li>'; } ?> </ul> </nav> <!-- End Pagination --> </div> </div> <!-- Add your footer content here --> <!-- ... --> </body> </html>