There is a page that displays a grid of images that are stored in the folder, and are displayed on the page thanks to the MySQL query, where the paths to the images are stored.

It is necessary to make pagination with these images. That, say, on the first page 40 images were displayed and on subsequent pages as well. How can I do that?

 <?php $img_url = "uploads/"; $result = mysql_query("SELECT images.id as imgid, images.image_name, images.user_id_fk, users.id, users.login FROM images,users WHERE images.user_id_fk = users.id ORDER BY images.created ".$sort); while($row = mysql_fetch_assoc($result)) { echo ' <div class="column is-one-quarter container1"> <a href="img.php?img='.$row['imgid'].'"> <figure class="image image is-square"> <img style="object-fit: cover; cursor: pointer;" src="'.$img_url.$row['image_name'].'" /> </figure> <div class="overlay"> <div class="text">'.$row['login'].'</div> </div> </a> </div> '; } ?> 
  • as well as any other pagination with the help of the LIMIT statement in the request - teran
  • What pagination technology do you use? - Roman C

1 answer 1

Read about LIMIT here: https://ruhighload.com/%D0%98%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0% % D0% B0% D0% BD% D0% B8% D0% B5 + mysql + limit

Further use convenient for you paginator. Or write your own.