I have a list of files that are pictures but i want to have
<- previous next -> under each picture that goes to the next picture.

Was thinking maby should create an array of all the images and then echo out the array

I think it's not effective way if we create an array of all the images and then echo out the array.

Maybe you can use below algoritma (below are not working codes) :

$Page = $_GET;
$ImagesPerPage = 10; //number of images per page

$StartImage = $Page * $ImagesPerPage;
$q = "SELECT * FROM table_images ORDER BY id ASC LIMIT $StartImage, $ImagesPerPage";

/*
Show your Images here
*/

//Paging here:
echo "<a href='$PHP_SELF?page=". ($page - 1) ."'>previous</a>";

echo "<a href='$PHP_SELF?page=". ($page + 1) ."'>next</a>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.