Alexhoward Posted March 14, 2008 Share Posted March 14, 2008 Hi guys, Loving this site, as a newbie, who doesn't know what he's really doing, i'm made some pretty good progress. Mainly down to you lot! and a bit of google So what would i like to do? 1) members rate there links (pulled from whatever they've chosen from the main page) using a 5/10 star rating system 2) the content on the main page then displays the average of the users votes under each link. some main points: 1. I want the members to be able to change their rating, and just display their vote on their page. (incase they really like the link, then one day it all goes wrong, and they hate it) 2. on the main page to display the average of all the votes under each link, as a static vote 3. Only members can vote (from their page) Does this make sense...? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/ Share on other sites More sharing options...
PHP Monkeh Posted March 14, 2008 Share Posted March 14, 2008 Set up a `ratings` table (or something named similar) that will store all the ratings in it. Set the table structure so it's something like this: id link_id user_id rating id will be the unique identifier of the rating link_id is the id number of the link which was rated user_id is the id number of the user who voted rating is the number which they voted (1-10) With this structure you'll be able to get a total number of votes, averages, and because of the user_id field you'll be able to allow the user to edit their own votes (show a list of votes where the user_id field = their id). It can be quite a complicated system, but this is a basic outline and can get you going. Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492156 Share on other sites More sharing options...
Alexhoward Posted March 14, 2008 Author Share Posted March 14, 2008 Nice one, that seems obvious enough. that table has the potential of getting enomous thou... is that going to slow down my site? also i take it that when i display the average on the main page, i just pull an average of the votes where the link equals the linkid? Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492160 Share on other sites More sharing options...
laffin Posted March 14, 2008 Share Posted March 14, 2008 I wud skip the id and have it link_id user_id rating with the link_id and user_id as primary keys. it does have the potential of getting huge, however sql is a database, driven for large amounts of data. the average can be done thru mysql as well SELECT link_id,AVG(rating) as avg_rating FROM ratings GROUP BY link_id Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492185 Share on other sites More sharing options...
scepanmali Posted March 14, 2008 Share Posted March 14, 2008 Try this website: http://js-kit.com/ See if they are good for you! Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492193 Share on other sites More sharing options...
Alexhoward Posted March 14, 2008 Author Share Posted March 14, 2008 Cheers Guys, Yea will just have it: Link, username, rating and cheers that link looks like the kind of thing i'm after however, when the user changes there vote, i want it to replace to vote they already made, assume that's just a little change in the code... or not so little haven't got time to look at it all now Thanks Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492205 Share on other sites More sharing options...
PHP Monkeh Posted March 15, 2008 Share Posted March 15, 2008 If you're wanting to update their vote, just update the row where the user_id = their id, and the link_id = whichever link they're editing, something like this: UPDATE `ratings` SET `rating` = rating + 1 WHERE `user_id` = '{$user_id}' AND `link_id` = '{$link_id}' Of course you'll need to get the values of $user_id (probably from a session) and $link_id (probably from the update form). Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492780 Share on other sites More sharing options...
june_c21 Posted March 15, 2008 Share Posted March 15, 2008 this might help http://www.roscripts.com/AJAX_PHP_rating_script-145.html Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-492786 Share on other sites More sharing options...
Alexhoward Posted March 17, 2008 Author Share Posted March 17, 2008 Hi guys, Thanks for the links, What i'd really like is a star graphic script like http://js-kit.com/ which scepanmali suggested, but one that's on my own site, using my database, rather than some other website. I'm finding this part really dificult. The other parts of my site, have been hard but i've been able to get through it, with this however, i'm really stumped, don;t even really know where to start. Does anyone know a good tutorial for a 5 star rating script...? Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-493927 Share on other sites More sharing options...
Alexhoward Posted March 17, 2008 Author Share Posted March 17, 2008 This one looks promising... http://www.nickstakenburg.com/projects/starbox/ Quote Link to comment https://forums.phpfreaks.com/topic/96143-star-rating-script-anyone-know-one-that-can-do-this/#findComment-493945 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.