0

I need to build a website where users can upload their photos, and vote other people photo, like Facebook like

i was thinking the best ( or only way ) to store this info:

1 - i can just use a simple counter on photo records, and check in session if people would vote more than once ( vote are just for fun ) but on a new session i can vote the same photo again

2 - the other way is create a table where i store userid and photoid, this way user can't vote more than once, but i'm not sure if database grow could became an issue since table will grow larger and larger

3 - A text field on user record where i store a list of photo id, and i can build a session array on login or just build a PHP array on page load. This could be the best way, i guess i can have issue if i need to search or count on specific situations. LONGTEXT should contain 4Gb so i think i would never reach maximum lenght

4
  • Do you have a specific question? Commented Nov 13, 2013 at 8:41
  • #2 is the way to go. And don’t worry about database size – database systems are designed to handle large amounts of data. Just set the right indexes for performance. Commented Nov 13, 2013 at 8:41
  • That sounds like a plan, go for it. Commented Nov 13, 2013 at 8:41
  • sorry, yes i was asking which is the best way to do it, for long term project, i edited title Commented Nov 13, 2013 at 9:19

3 Answers 3

1

I'm assuming your question is:"What is the best way?" I would say 2 would be the best since that's the easiest to check wether a person has voted yet. The table won't get too big. People are using tables also for registering users and those can be alot as well.

Sign up to request clarification or add additional context in comments.

4 Comments

each user can vote unlimited photo, so if i get 100.000 users and each would vote 1000 photo i would get 100.000.000
@al404IT Still think it's not too big. 2 Should be the best solution.
i found this answer also stackoverflow.com/questions/1276/…
@al404IT That answer is good. Of course the answer is about how big a database can get.
0

yes you can move forward with the idea of text field on user record to store comma or pipe separated photo id

or text field on the photo record to store comma or pipe separated user id who liked that photo.

Its much better than creating a relational table

Comments

0

Here what you are trying to do is trying to create a website like Mark Zuck created earlier (Facemash). http://www.facemash.com.au/

You can download this script from http://webtify.com/internet/facemash-clone-script/802/

Regarding your logic : I think that #3 is good for this script

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.