pbcommun
08-02-2005, 05:35 PM
im starting on a new site soon, and i want people to be able to give a 1-5 star rating on certain pictures/whatever.how can i code this? Anyone know any good premade scripts? This wouldnt require anything complicated....right?
retrogad
08-02-2005, 10:41 PM
I've got an image portal on my website (http://photoshop.retrogade.com), and it features a 0-5 voting panel (same kind of thing you're describing). It's set up so that, if the user clicks the 3, it goes to a vote.php page that adds 1 to the vote count and 3 to the point count, all inside a SQL database. To show the picture's current score, divide point count by vote count. My actual system is quite a bit more complicated than this (votes are weighted depending on a user's "voting power"), but this simplified concept should do the trick.
1) Have star links on the viewing page, linked to a vote.php page and sending &vote=0, &vote=1, &vote=2, etc.
2) In the vote.php page, update the SQL database, adding 1 to vote count and $vote to point count.
3) To display score, read vote count and point count from SQL database and divide points by votes.
I can write up a simple voting script, if you need.
pbcommun
08-06-2005, 09:35 PM
that would be great. I have no expereince with SQL. Just php and HTML. I would be able to add the "rating form" on any page in any spot i want, right?