Jump to content

which is best? what does facebook do?


jonniejoejonson

Recommended Posts

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

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 <

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.