I\'m working on a PHP/MySQL rating system right now. For the user to be able to rate the user has to log in. Each user has a unique \"UID\". There will be multiple rating in
It is inefficient. What you have here in relational terms is a many-to-many relationship between users and games. A user can vote on many games. A game can be voted on by many users. The solution for this is to have a join table:
USERS (uid, name, ...)
GAMES (gid, name, ...)
VOTES (id, uid, gid, ...)
Where uid and gid are foreign keys back to their respective tables.
If someone votes, insert a record in VOTES.
To get a list of votes for a game:
$get = mysql_query("SELECT * FROM votes WHERE gid = $game_id");
...
To get a list of the user's votes:
$get = mysql_query("SELECT * FROM votes WHERE uid = $user_id");
...
and so on.
Don't join an array and store it in a single column. You're right to avoid that.
In a normalized database, you should store it in a junction table:
UserRatings
-------------
RatingID int
UserID int
UserVote int
I don't know what are your queries. Depending on the application, this might not have the acceptable performance. However, in either case, I suggest you go with the normalized approach, benchmark, and denormalize only if appropriate.