PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $query = "SELECT VERSION() as version;"; // Pagination settings $resultsPerPage = 10; // Number of records per page $page = isset($_GET['page']) ? $_GET['page'] : 1; $offset = ($page - 1) * $resultsPerPage; // SQL query with LIMIT and OFFSET $sql = "SELECT * FROM your_table LIMIT $offset, $resultsPerPage"; $result = $mysqli->query($sql); // Get total number of records for pagination calculation $totalRecordsSql = "SELECT COUNT(*) FROM your_table"; $totalRecordsResult = $mysqli->query($totalRecordsSql); $totalRecords = $totalRecordsResult->fetch_row()[0]; $totalPages = ceil($totalRecords / $resultsPerPage); // Fetch and display results (you'll replace this with your actual HTML table) while ($row = $result->fetch_assoc()) { // ... your code to display each record ... } ?>
Show:  
Copy Clear