tags:

views:

25

answers:

1

Hi guys, I have two tables here:

Gallery
ID | Name | Description

Image
ID | Title | Caption | GalleryID

I got the code all set to make a simple image gallery by listing all the thumbnails or paging through the thumbnails. However what I need to do is accomplish something like the gallery here only without the javascript and ajax:

http://gulfnews.com/pictures/news/abandoned-cars-around-uae-1.655965

I want a select number fo thumbnails to show beneath the main image and as and as teh user clicks on teh thumbnails it opens the page with the newly selected image as highlighted and the series of thumbnails on the botto moves ahead by one. if its not the last image that is.

How do I do this? I'd like a quick and dirty way to do this? I'm using php and mysql here for the database - just need the code to show the 'paginated'images below the main image. i know how to set up everything else i.e thumbnails resizing etc...

+1  A: 

I don't know if MySQL has a ROWNUMBER() function like T-SQL for numbering your rows, but the smart way to do it is to have a sequential numbering of your images in the database. From there, you query your database by saying something like:

SELECT TOP [images_per_page] WHERE Row_Number > [images_per_page] * [page_number - 1].

That way you only pull back the data you need. You keep track of the page number, most likely in your query string.

That's pretty simplistic, but hopefully it gives you an idea of how to start.

ThatSteveGuy