Jump to content

Starbox! Please help! i don't know where to start...


Alexhoward

Recommended Posts

Hi guys,

 

you lot have a been a real help in the past, and i'm sorry to ask so much with this post

 

but i'm soo confused....???

 

i really want to add a star rating script to my site, and found one i really like.

 

it's called starbox http://www.nickstakenburg.com/projects/starbox/

 

all the others i found done IP tracking to stop people voting more than once but i don't want that

 

Problem is, he doesn't explain how to use it in PHP, or indeed how to put it on your page.

 

I'm realativley new at this, and i assume it's something you should already know before you start... :)

 

the idea is:

 

members page - vote, change vote - saved in sql table, update previous vote

 

Main page - average of members vote - static image

 

Thanks in advance

 

it will be a real help if someone can point me in the right direction, or get me started on some code

 

Thankyou!!

Link to comment
Share on other sites

why not write your own in 5 minutes?

you need a few things

 

1) A table of stuff to be rated

2) A table of ratings

3) A criteria that limits the voting (for this example say a users table with UserID)

 

So you have something to be rated the user inputs a value 1-5 pass it via get post ajax whatever floats your boat

 

Then you:

1) Query the Ratings table for a vote for that UserID and ItemID

2a) If a vote exist update query to replace old vote with new

2b) Add vote if no vote exist

 

Then to output results

1) Query for results based on AVG(Rating) from `Ratings` Where ItemID = $itemid

2) Output however you like.

 

 

Thats the idea

 

Link to comment
Share on other sites

the stars are always the big problem the way I have done it is I make a table with 5 cells in it (for 0-5 rating) and each cell's background image is a star.  The style of the cell is determined by the mysql AVG

i.e

<?php
$avg = 4.567;
$avg = round($avg,0);
$i = 1;
while($i <6){
echo "<td ";
if($avg >= $avg){ echo "class=\"filled_star\"";}
else{ echo "class=\"unfilled_star\";}
echo "></td>";
$i++;
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.