DATA BASE/RATING SYSTEM

MySQL related discussion or help, including phpMyAdmin.

DATA BASE/RATING SYSTEM

Postby insomniacmonkey » Wed Feb 17, 2010 2:05 am

ok I need help setting up my DB for a rating system. I need users to be able to rate on items only once. I don't now how to set it up so after they vote they cannot rate again. and how to check if they already rated.

example
..............................................................................................

Rating System
Item-------currentRating-----Votes-------whoRated
Candy------4.5------------------3----------Chad Don Greg Tim SexyMan
...................................................................................................

I know how to check if their name is in there, how to add a new person in there, add a vote every time someone votes and how to change the currentRating based on number of votes. i dont know how to make the script check if they have rated on it.
insomniacmonkey
 
Posts: 1
Joined: Wed Feb 17, 2010 1:57 am
Online: 0s
Karma: 0

Re: DATA BASE/RATING SYSTEM

Advertisment

Advertisment
 

Re: DATA BASE/RATING SYSTEM

Postby bowersbros » Wed Feb 17, 2010 8:48 am

I personally wouldnt do it this way, as you cant display back to the user what they voted, and offer them to change their vote.

I would normally do:
ratings:
-id
-voter_id
-product_id
-vote

Where:
-id is AUTO_INCREMENT PRIMARY KEY INT(11)
-voter_id INT(11) (users id)
-product_id INT(11) (What they are voting on)
- vote (enum('0','1','2','3','4','5')) (value they vote)
The early bird catches the worm but the second mouse gets the cheese!

If you look like your passport picture, you probably need the trip.

---

IM contact details:
Example doesnt work, requires a href
bowersbros
Top Contributor
 
Posts: 2019
Joined: Tue Apr 21, 2009 7:55 pm
Location: United Kingdom
Online: 4d 10h 49m 56s
Karma: 6


Return to MySQL/phpMyAdmin

Who's online?

Users browsing this forum: No registered users and 1 guest