I'm trying to make a membership system where users can 'approve' or 'disapprove' another member only once. If they have approved the member previously or disproved the member previously, I want to be able to detect it.

I also want to display the average user approval for each member on their profile. (# of approvals/ # of approval+disapproval received)

I'm thinking of having 2 tables:
1. The `members` table - basic user info
2. The `ratings` table - each row is an entry for when user#1 votes (+ or -) for user#2.

My concern is this:
1. Is this the most efficient way to implement such a system? If not, can you please suggest a better way to do it?
2. Will it take up too much resources if I have to query the ratings table everytime I have to fetch the average rating?

Thanks for helping me. *in advance haha*

users can 'approve' or 'disapprove' another member

User is Member?! or each another entity!!

Eep. Sorry for switching terms... Users are the same as members.

[User] table still the same
[Rating] table has (Voter_Member int #, Voted_Member int #, Rating int)
- Composed primary keys (to maintain user can't de\vote user two times)
- Rating int (if you need some higher rating 1 2 3 4 or -1 -2 -3 -4)

commented: he saved my tables... haha +2

*googles primary key... 0.0*

So I have to set voted_memberID and voter_memberID as primary keys?

Yey! Thank you so much for the advice. ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.