setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Define the number of results per page $results_per_page = 30; // Get the current page number from the URL (default to page 1) $page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int) $_GET['page'] : 1; $offset = ($page - 1) * $results_per_page; // Get total number of records $total_stmt = $conn->prepare("SELECT COUNT(*) AS total FROM `scc24` WHERE type = 'faculty'"); $total_stmt->execute(); $total_rows = $total_stmt->fetch(PDO::FETCH_ASSOC)['total']; $total_pages = ceil($total_rows / $results_per_page); // Fetch paginated records $stmt = $conn->prepare("SELECT * FROM `scc24` WHERE type = 'faculty' ORDER BY id DESC LIMIT :limit OFFSET :offset"); $stmt->bindValue(':limit', $results_per_page, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $content = $stmt->fetchAll(PDO::FETCH_ASSOC); ?>
Page Content List