php - How to display images page by page ? -


i developing online shopping website. unfortunately, blocked issue of displaying images database.

the outcome want achieve retrieve images database , display them in different pages. example, there 12 images totally in database, display 6 images @ 1 page. and, when user click on next page (page 2), rest 6 images displayed. have been stuck on many days. can 1 me solove problem. best wishes.

try

<?php if(isset($_get['page']))  {$page = $_get['page'];} else  {$page = 1; } $firstimage = $page * 6 - 6; $lastimage = $page * 6; $sql = 'select * image limit $firstimage, $lastimage'; ?> 

and add link @ botom

<a href="yourpage.php?page='<?php echo $page + 1; ?> '">next page</a> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -