Lets say I'm trying to build a thumbnail of some gallery (5 thumbnails showing). How can I get my mysql to display 5 thumbnails, the middle thumbnail will be the image blown up, and the two on the left of the middle will be previous images, and the two other images on the right of the middle will be 2 more images after.
EDIT
I know how to easily get 5 thumbnails with something like this
$sqlThumb = mysql_query("SELECT iID,thumbnails,userID FROM images WHERE userID = ".$_SESSION['userID']." ORDER BY iID ASC LIMIT 1,5");
But the thing is, I dont have a consistent id (meaning, there will be deleting and inserting). It is based on the images that the user has.
iID userID
----- --------
1 5
2 4
3 4
4 5
5 5
6 5
10 5
11 5
12 5
So if a user clicks an image which shoes iID number 5, the thumbnail should show like this in order, 1,4,5,6,10.
However, also if a user clicks on thumbnail number 10, the thumbnail should show: 5,6,10,11,12.