Ajax Visitor star rating scriptThis is a simple rating script where users are asked to rate an article in a scale of one star to five star.
To understand this script you must have knowledge of PHP MySQL and Ajax concept. If you are not yet comfortable with Ajax then you can read the basic rating script using PHP and MySQL
For Demo of this script , click the button towards the end of this page.
Features of this rating script
Rating scale of 1 to 5 stars is opened in a new window with period buttons for users to select.
On Selection the data will be added to table without refreshing the page ( Ajax ) and the window will close automatically.
MySQL TableTo keep the script simple we have used one single table and here is the structure.
Unique Page name.Each page should have one unique identification number or page name and this is to be passed to our script as we are using common page to display the rating window.
Integrating the rating pageFrom each page of your site you can integrate the rating window by including it.
Inside this common-tag2.php page we will keep the radio buttons to receive user selection. Each radio button is connected to Ajax function by onClick event and it passes the rating value to the ajax function.
Displaying the rating of pages ( display.php ).Displaying of rating is left to users to customize according to their requirement but we have given one simple query page display.php to display the total count of ratings and its average value. By clicking the page name users can see the all the ratings of that particular page.
Displaying the top fiveThis query page can be further modified to display the top rated pages, or getting the top five rated pages by adding order by and limit SQL commands to our above query.
This article is written by plus2net.com team.
| ▼ PHP MySQL Scripts