Ajax Rating System: Create Simple Ajax Rating System using jQuery AJAX and PHP.
Simply programmed, CSS based stylish Ajax rating system which you can use any where to put a stylish jquery effect based rating system.
Table Structure:
CREATE TABLE `ajax_ratings` ( `id` int(11) NOT NULL auto_increment, `image_id` int(11) NOT NULL default '0', `rating` int(11) NOT NULL default '0', `users_ip` varchar(200) NOT NULL default '', PRIMARY KEY (`id`) )
Javascript Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | $(document).ready(function(){ $('#loader').hide(); $('#inner').children().click(function(){ var a = $(this).attr("id"); $.post("rating.php?value="+a, { }, function(response){ $('#inner').fadeOut(); $('#inner').html(unescape(response)); $('#inner').fadeIn(); setTimeout("hideMesg();", 2000); }); }); }); function hideMesg(){ $('.rating_message').fadeOut(); $.post("rating.php?show=1", { }, function(response){ $('#inner').html(unescape(response)); $('#inner').fadeIn('slow'); }); } |
PHP Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | include("dbcon.php"); $users_ip = $_SERVER['REMOTE_ADDR']; if($_REQUEST['value']) { $id = $_REQUEST['value']; $result = mysql_query("select users_ip from ratings where users_ip='$users_ip'"); $num = mysql_num_rows($result); if($num==0) { $query = "insert into ratings (rating,users_ip) values ('$id','$users_ip')"; mysql_query( $query); $result=mysql_query("select sum(rating) as rating from ratings"); $row=mysql_fetch_array($result); $rating=$row['rating']; $quer = mysql_query("select rating from ratings"); $all_result = mysql_fetch_assoc($quer); $rows_num = mysql_num_rows($quer); if($rows_num > 0){ $get_rating = floor($rating/$rows_num); $rem = 5 - $get_rating; } } } |
Who I Am

Zeeshan Rasool
Software Engineer - PHP
Lahore - Pakistan
zeeshan(@)99points.info
Skype: zeeshan-rasool
gTalk: zishan.rasool85
Categories
- AJAX (37)
- Codeigniter (16)
- CSS (16)
- Facebook (11)
- Joomla (1)
- JQuery (53)
- Miscellaneous (4)
- Mootools (1)
- MySQL (6)
- PHP (60)
- SEO (2)
- Technology (6)
- Tutorials (15)
- Twitter (2)
- Web Design (23)
- Web Development (57)
- WordPress (2)
Tags
99points
adobe
AJAX
ajax pagination
ajax rating
ajax tutorial
ajax voting system
captcha
Codeigniter
codeigniter 2.0
codeigniter recaptcha
CSS
css tutorials
dreamweaver cs5
Facebook
facebox
farmville
ffmpeg
flv
google api
hacking
Joomla
JQuery
JQuery Gallery
JQuery menus
Jquery tutorial
mafia war
Mootools
MySQL
pagination
Payment
PHP
php curl
recaptcha
RSS Feed
SEO
simplepie
socail networking
ssl
Tutorials
Twitter
wall script
Web
XSS
youtube
Comments
- ZeeShaN on Facebook Wall Script Clone with JQuery and PHP: Personal Project BETA Version 2.0
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on JQuery Based Flipped Image Gallery with Bounce Effects
- 20 + Fresh jQuery Image Gallery/Slider Plugins and Tutorials Worth a Look | free on Fresh JQuery Image Gallery with Captions and Auto Play/Pause Rotation
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on jQuery Tutorial: Create jQuery and CSS based Awesome navigation.
- 25 Cool and Helpful jQuery Plugins/Tutorials For Your Next Project | free on Ajax Tutorial: How to Create Ajax Search Using PHP jQuery and MYSQL
ZeeShaN







hi Codie, I will write a tutorial in Codeigniter later in the next month.
hey can u customize dis module in codeigniter??plz do it….
hey can u provide me this rating system in codeigniter.???
thanx in advance…..
Dude Update table name “ratings” to “ajax_ratings”. Because in you MySQL query you are creating a table named “ajax_ratings”.
[...] system or Voting system is very common in web sites. Voting can be about your site or blog or some other thing just to get [...]
[...] method or Voting method is really widespread in internet internet sites. Voting can be about your internet site or weblog [...]
[...] system or Voting system is very common in web sites. Voting can be about your site or blog or some other thing just to get [...]
[...] system or Voting system is very common in web sites. Voting can be about your site or blog or some other thing just to get [...]
[...] tutorial in Rating System series is here for you. It is a stylish and animated rating system I created many Ajax based Rating [...]
[...] tutorial in Rating System series is here for you. It is a stylish and animated rating system I created many Ajax based Rating [...]