Hello i am looking for a rating script and i have basic knowledge of PHP and Sql. Can you show me one?

Recommended Answers

All 8 Replies

how about this?

Thanks i am trying to manage it

Is it certain that it works? because i followed the instructions and havent got any results

Dude, you need to read the instruction properly.

First run the test.html page on your localhost. Then once you got it working, do the mysql version.

Let say you will be running or testing the script on your localhost/rating,

  1. unzipped the downloaded zip file.
  2. inside the unzipped file, locate 5_stars_rating_script.zip
  3. Unzipped 5_stars_rating_script.zip

On your localhost root directory create a directory called rating

  1. open the rating directory and move these directories (ratingfiles,ratingtxt,and test.html), from the unzipped 5_stars_rating_script directory.

  2. load the rating/ratingfiles/rating.js on your text editor

find line 41 and look for this code

star_sp.style.background = 'url("ratingfiles/star2.png")';

change it to

star_sp.style.background = 'url("http://localhost/ratingfiles/star2.png")';

now, scroll down the page around line 105 and look for this code

 cerere_http.open("POST", '/ratingfiles/ratings.php', true);

change it to this

cerere_http.open("POST", 'http://localhost/rating/ratingfiles/ratings.php', true);

Lastly, load the test.html file on the editor and find this line

- Here can be an image, img1.jpg

replace the string above with your test image

 <img id="yourImage" src="yourImage.jpg" />

save all of your changes and direct your browser to localhost/rating/test.html

You should be viewing something like the screenshot below

02824e6d20b311400e6401733636ca11

ok veedeoo i did it! Thanks man.
i modify the id attritube so it can rate multiple pages
<div class="srtgs" id="rt_<?php echo $msg_id;?>"></div>

i have only one question

it says in the instructions that if you want to save the data in the database
To set the script to use MySQL, change the value of the constant <b>SVRATING</b> from '<i>txt</i>' to '<b>mysql</b>'

i did that and the rate doesnt appear on the page.
if i change it to 'txt' again, it re-appears.

these are the tables on my database

../ratingtxt/rtgitems.txt
../ratingtxt/rtgusers.txt

the connection is ok

That would be on the file called ratings.php,

on the top of the page, it says

define('SVRATING', 'txt');        // change 'txt' with 'mysql' if you want to save rating data in MySQL

// HERE define data for connecting to MySQL database (MySQL server, user, password, database name)
define('DBHOST', 'localhost');
define('DBUSER', 'root');
define('DBPASS', 'passdb');
define('DBNAME', 'dbname');

put your database credentials and save your changes and change 'txt' with 'mysql'.

One final step is to direct your browser to the file named create_tables.php. On success, the script should create two database table to store ratings and day the items are rated.

It is my assumption that the script should work from this point and on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.