PDA

View Full Version : Ratings Script


pgowder
28 Nov 2001, 21:35
I need some help on a project.

I'm developing an event script for my site. I want to let the users rate each event.

I need to first make sure the users is logged in, then let them rate it, and make sure they only rate it once.

Also how do people display the ratings in stars?

Does anybody have some samples of rating scripts that I can use to get me started?

thanks

Palmer ofShinra
29 Nov 2001, 12:23
$bbuserinfo is the key.

if ($bbuserinfo[userid]==0) {
// not logged in message goes here
} else {
// they are logged in, check to see if they've voted
}

You would use $DB_Site->query_first("SELECT * FROM eventratings WHERE userid='$bbuserinfo[userid]'");

If that returns an empty array, they haven't voted.

When they do vote, be sure to note down their userid as a check that they have voted.