What is the best way to display large amounts of data from a MySQL database in a PHP page without overwhelming the user?

When displaying large amounts of data from a MySQL database in a PHP page, it's best to implement pagination to break up the data into smaller, more manageable chunks. This helps prevent overwhelming the user with too much information at once and improves the overall performance of the page.

<?php
// Connect to MySQL database
$connection = mysqli_connect("localhost", "username", "password", "database");

// Define how many results to display per page
$results_per_page = 10;

// Determine current page number
if (!isset($_GET['page'])) {
    $page = 1;
} else {
    $page = $_GET['page'];
}

// Calculate the starting point for the results on the current page
$starting_limit_number = ($page - 1) * $results_per_page;

// Query to retrieve data with LIMIT clause for pagination
$query = "SELECT * FROM table_name LIMIT $starting_limit_number, $results_per_page";
$result = mysqli_query($connection, $query);

// Display data on the page
while ($row = mysqli_fetch_assoc($result)) {
    echo $row['column_name'] . "<br>";
}

// Pagination links
$query = "SELECT COUNT(*) FROM table_name";
$result = mysqli_query($connection, $query);
$row = mysqli_fetch_row($result);
$total_records = $row[0];
$total_pages = ceil($total_records / $results_per_page);

for ($i = 1; $i <= $total_pages; $i++) {
    echo "<a href='page.php?page=".$i."'>".$i."</a> ";
}

// Close MySQL connection
mysqli_close($connection);
?>