Reputation: 11
I want to create a rating system (Ajax) with PHP for some images. Only registered users will be able to vote so i am going to store their id.
My question is should i create a table in MySQL where i will store the user id and photo id for all the images/ratings or should i write a script which will create a seperate SQLite file/database for EACH image where it will store the users' ids who voted.
I am going to use this table only to check if the user voted for this image or not. Total votes and score will be stored in another MySQL table.
Which would be faster?
MySQL (containing users' ids who voted from ALL the images)
image_id | user_id
---------------------
114 | 12
114 | 24
114 | 53
114 | 1
or
1 SQLite file foreach image rating
image_114.sqlite
user_id
-------
12
24
53
1
Upvotes: 1
Views: 144
Reputation: 65274
My recommendation is to use the structure from your first example, but without a hard dependency on MySQL, so SQlite could still be used. Here is why:
Upvotes: 1