I'm developing an image gallery and on a page I want to show a single image and bellow it a thumbnails of 10 other images from the same gallery. The photo I am viewing should be in the middle of these thumbnails.
For example, there are 20 images in the gallery with ids:
On the page that displays the image 11, there would be these thumbnails (11 in the middle):Code:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
On the page that displays the image 14 there would be these thumbnails (again 14 in the middle):Code:7, 8, 9, 10, 11, 12, 13, 14, 15, 16
And so on. Of course, ids doesn't have to be so periodical, there might be larger setbacks like this:Code:10, 11, 12, 13, 14, 15, 16, 17, 18, 19
How would SELECT query to achieve this look like?Code:2, 9, 15, 17, 26, 27, 28, 34 etc








Bookmarks