Multi Ajax Star Rating

This is a rating bar script done with PHP and mySQL that allows users to rate things like can be done on Netflix or Amazon, all web 2.0-like with no page refresh. It is a major improvement on the previous version because it is now unobtrusive, meaning that if Javascript is off it will still work (although the page will refresh). You can also set the number of rating units you want to use (i.e. 4 stars, 5 stars, or 10 stars) on a rater to rater basis (see samples below or read the docs). A few other changes were made as well - see the docs for details. Note that this script isn't tied to any specific system (such as WordPress), so you should be able to adapt it to your situation without too much trouble.

Multi Ajax Star Rating demo

Changes to the code below will update the demo above in real time.



Sept. 27, 2007, 6:51 a.m. - lemon

Good example but how can I get all example code.

Oct. 1, 2007, 6:18 p.m. - bestajaxscripts

Lemon, are you moron, all example codes are above the demo ratings, closly :)

Nov. 26, 2007, 2:12 p.m. - matsuke

its not a good example for a ie7, but it works perfect on firefox

Jan. 22, 2008, 8:57 p.m. - sanketh

how can i implement this code in our program

Aug. 26, 2008, 9:19 p.m. - Sitthykun LY

test star rate

Sept. 11, 2008, 12:15 p.m. - qmg

this script rocks!!

Sept. 26, 2008, 4:52 a.m. - Lindgreen

Danke.ich bin ein Stück weiter mit der Installation.

Sept. 30, 2008, 3:34 a.m. - thodo

a really nice Script.

Nov. 4, 2008, 3:23 p.m. - K

Anyone know how I can include this on multiple records like a voting of random things in a db?

Nov. 13, 2008, 6:42 p.m. - comment

i have a problem its says this: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-e_starrate.ratings WHERE id='id21'' at line 1

Dec. 9, 2008, 9:46 p.m. - josh

any1 tried this on a framework?

Dec. 30, 2008, 8:51 a.m. - Sam

I don't have this star rating script installed, but I have another that looks and works almost exactly the same. Isn't anybody else receiving TONS of spam ratings? Every day I get like 100 random spam ratings from an IP. I wish I had more talent in the Ajax department as I'd create a little pop-out bar or something with a mini captcha in it. What I've had to do is add another 'status' field to the MySQL table. It gets set to 0 by default. At 0 it is not factored into the rating. Then about once a week I go into PhpAdmin and delete all the phony looking entries (a slew of votes from the same IP on multiple items). What's more, I can't figure out what the benefit is to the spammer.

Feb. 2, 2009, 12:29 p.m. - phil

ive got this problem. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-ratings.ratings WHERE id='id21'' at line 1

Feb. 20, 2009, 1:14 p.m. - ilen

como lo bajo???

March 12, 2009, 8:40 a.m. - dbass007

I have put this script in my project, but there's still a problem : when the one of the stars is clicked, the whole page is refreshed. I got a folder with the example as I has downloaded it and it works fine. but not when it is implemented in my website. Thanks

June 13, 2009, 5:01 p.m. - CAESAR

Thanks! Star Rating is very good:)

Aug. 27, 2009, 3:43 a.m. - Oyeme

I did better version without checking Ip every time,when you want to vote. It's not correct for me , because it's just another query - For an example ,u have on the page 10 rate bars, it's equal 10 queries. I did some modifications with using "Cookies",every time i checking a cookie array seperated by ";", It's look like "2;3;43; I just searching my id number in cookie array. Logical system is the same,i just use cookies with lower sql queries. For code u could write me :) I deleted

Oct. 1, 2009, 10:52 p.m. - goweb99

nice script...i had tried it and loves it..

Oct. 9, 2009, 4:20 a.m. - san

Cool script, thanks

March 30, 2010, 9:09 p.m. - pooja

good example,but can u give me full code for this

April 9, 2010, 10:15 p.m. - devi

good but can u provide me this example with using C# with asp.net coding

April 23, 2010, 9:04 p.m. - nilesh

Can you provide me the full code of this rating example?

April 23, 2010, 9:07 p.m. - nilesh

Can you provide me the full code of this rating example? it is showing error like error: require() [function.require]: Failed opening required '_drawrating.php' please provide me _drawrating.php file.

April 24, 2010, 10:01 a.m. - Priyank

Pooja, i think its a full HTML code.I have tried. U can......

July 2, 2010, 1:09 p.m. - Chris

This is not working on Chrome?

Sept. 12, 2010, 6:32 a.m. - mary

nice but not so....

Oct. 25, 2010, 5:09 p.m. - Fredy

Very helpful. Nice job.. Thanks for sharing

Nov. 16, 2010, 9:31 a.m. - Frank

Great Ajax star rating system. I'd like to promote that on my site. I have some good widgets there. Check them out at appsandwidgets.net