In my site I have an image gallery that shows all of the thumbnails from an album and an enlarged photo of the photo the user has selected.
I have a query which selects all the photos (objects) from the album the user is currently viewing :-
and a query which selects the current photo from the objects table and all it's details based on what thumbnail the user has clicked:-Code:$result = mysql_query("SELECT objects.object_id FROM objects LEFT JOIN objects_albums ON(objects_albums.object_id = objects.object_id) LEFT JOIN albums ON(objects_albums.album_id = albums.album_id) WHERE albums.album_id = ?");
This works fine and allows users to click thumbnails to navigate the photos however I want to display photo indexes i.e. if the user goes to the 10th photo in an album of 17 photos "10 of 17" should be displayed.Code:$result2 = mysql_query("SELECT objects.object_id, object_image FROM objects WHERE objects.object_id = ? "); $row2 = mysql_fetch_array($result2);
What is the best/most efficient way to achieve this?


Reply With Quote
Bookmarks