Jump to content

Recommended Posts

When a website like facebook displays thumnails of all your photos but you have so many that it spreads over many pages.

 

1/ Do they query the database for the image names every time the page is turned...

 

orr

 

2/ Do they get all the images names on the first page then save that data in a session so that you dont have to query the database so often...

 

thanks to any responders.

Link to comment
https://forums.phpfreaks.com/topic/90272-creating-pages/
Share on other sites

Cheers guys but i've checked out tutorials on pagination, I was just wandering which would be better... the turoials all show use the first example that queries the database each time, I was just thinking that maybe for a large site like facebook it would better to use my second example. thanks J. 

Link to comment
https://forums.phpfreaks.com/topic/90272-creating-pages/#findComment-462851
Share on other sites

thats even a worse idea to store a say 1000 image names

 

first you lose the power of the mysql LIMIT function

Secondly you only have image names, mysql can store more than that like Comments or image titles, sizes, dates, etc.

Third image having 50k users * 1000 images in a gallery all being viewed at once, then image that all going in your session data (If you don't know this is a bad thing)

Forthly You are going to have to do some ugly manual array sorting.

 

Conclusion

Let MySQL do it.

Link to comment
https://forums.phpfreaks.com/topic/90272-creating-pages/#findComment-462852
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.