jonniejoejonson Posted July 31, 2008 Share Posted July 31, 2008 Okay please help me with an example: Please imagine I am creating a social network. To create a page that displays all the thumbnails of an album that a user has created, I need to select all the filenames of the images in this album. If a user selects an image, we go to a new page that also has a ‘next image’ and ‘previous image’ buttons. On the thumbnail’s page do I 1/ save the names of all the images in this album to a session so that I don’t have to reselect them from mysql? to get the next and previous buttons to work or 2/ every time an image is selected to be viewed, I have to also select all other images in this album so that I can have the next and previous image? Hopefully you understand what I mean… thanks for your help. Link to comment https://forums.phpfreaks.com/topic/117549-which-is-best-what-does-facebook-do/ Share on other sites More sharing options...
discomatt Posted July 31, 2008 Share Posted July 31, 2008 Save the current image's id to a session. To select the next one, simply use... SELECT `filename` FROM `images` WHERE `id` > $_SESSION['last_id'] LIMIT 1 ...on the 'next' page That will select the next ID greater than the previous one... to use the previous image, simply use < Link to comment https://forums.phpfreaks.com/topic/117549-which-is-best-what-does-facebook-do/#findComment-604599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.