Jump to content

Visited photos ?


Rommeo

Recommended Posts

I have some thousands of photos about nature

I ll let visitors/members to see them one by one,

but I dont want to show them the same photo again after they visit 1 week later

 

How can I do this ?

What I think as a solution is;

For members;

I can store the ids (like "everest01") of the photos that member has visited , and show user the most visited photos that he/she has not see for next visit. But what I m wondering is, how will I take the photos from DB ?

 

select * from photos WHERE id not in ( $thousandsofvisitedphotoids ) ??

I m stuck here ?

 

For visitors ( not members ) ;

I can set a cookie that keeps the ids of visited photos.. when visitor visits the website again, I take the cookie and sent to $thousandsofvisitedphotoids and make a query again ?

 

I m stuck here, How you guys do this ? what's the logic of this ?

 

Link to comment
Share on other sites

For members, create an sql table that will contain a user's id + an image id, then select all the images for for that user that does not appear in this table.

For non-members, create a cookie and fill it with an array of the images' ids, then check on every image load if the img id is located in your cookie's array of viewed images.

 

Good luck!

Link to comment
Share on other sites

For members, create an sql table that will contain a user's id + an image id, then select all the images for for that user that does not appear in this table.

For non-members, create a cookie and fill it with an array of the images' ids, then check on every image load if the img id is located in your cookie's array of viewed images.

 

Good luck!

For members;

there will be thousands of photos, and thousands of members so there will be millions of rows ( combination table of userid and photoid) , by a select query and taking the ids, and another select query for taking except those ids ( to print non visited photos ), will not it take time processing the query ?

Link to comment
Share on other sites

Storing more than one value in a field is not good solution, especially when those values will be compared against individually. Although I don't really see the point of what you're doing, you should store the photos seen already in a separate table. The id of the photos should be the PK index of the photo rather than the name, too.

Link to comment
Share on other sites

Storing more than one value in a field is not good solution, especially when those values will be compared against individually. Although I don't really see the point of what you're doing, you should store the photos seen already in a separate table. The id of the photos should be the PK index of the photo rather than the name, too.

but there will be thousands of users+visitors(not member) and photos, in that table there will be millions of rows (combination)

visitedphotosTable

userid | photoid

3 -------- 5

3 -------- 6

2 -------- 5

.

.

.

I think there will be a delay while processing the query, wont there ?

 

Link to comment
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.