If the list of images you want is in a database then your definitely going to need to use a server side language such as php. Doing this in php lone means however that every click would refresh the entire page.
The other option is to use PHP combined with JavaScript to create an Ajax driven slideshow. For this, you have client side code that when a user clicks next makes a background request back to the server, php then looks up the next image and send this data back to JavaScript.
The other option of course is to simply dump all your data into a JavaScript array when the page is created (by PHP) and then use JavaScript to do the entire thing.
None of these options are particularly difficult if you know the technologies involved.