How to build infinite scroll?

Hello! Did infinite scroll on this article here www.w3bees.com/2013/09/jquery-infinite-scroll-with...

only used mysqli instead of mysql.

Here's what happened:

<?php
$page = (int) (!isset($_GET['p'])) ? 1 : $_GET['p'];
$sql = "SELECT * FROM bookings ORDER BY id DESC";
$start = ($page * $limit) - $limit;

if( mysqli_num_rows(mysqli_query($connection, $sql)) --> ($page * $limit) ){
$next = ++$page;
}
$query = mysqli_query($connection, $sql . "LIMIT {$start}, {$limit}");

if (mysqli_num_rows($query) < 1) {
header('HTTP/1.0 404 Not Found');
echo 'Page not found!';
exit();
} ?>


 <?php while ($row = mysqli_fetch_array($query)): ?>

 <?php echo $row['uuid']?>
 <?php echo $row['surname']?>
 <?php echo $row['entry_date']?>
 <?php echo $row['exit_date']?>
 <?php echo $row['price']?>
 <?php echo $row['phone']?>
!
!

 <?php endwhile?>
 <?php if (isset($next)): ?>
 <div class="nav">
 <a href="booking.php?page=list&p=<?php echo $next?>">Next</a>
</div>
 <?php endif?>
 

But the download doesn't finish, re-entry loaded in a strange order.

Please help to understand what I did wrong.
July 2nd 19 at 13:44
0 answer

Find more questions by tags PHP