TheFilmGod Posted December 22, 2006 Share Posted December 22, 2006 Hi,I need help getting a php mysql 5 star rating system on my website. I have a table column voting script that works, but the results end up with colorful bars and that isn't visitor appreciated ;) I was wondering if you can help me get a 5 star rating system where I can have it very simple. Just the starts and a click and poof! the average score is right there, and no wacky colorful bars. Furthermore, I was hoping if you can integrate it as PHP with Mysql, since that would be the most efficient way to do it now. Lastly I would like for my homepage and the sidebars to be able to connect to the MySql data and arrange the top voted content first. A lot like youtube or those other websites that have the pictures dynamically changed by itself, - depending on the final rating. Any help are suggestions would be greatly appreciated thanks!- TheFilmGod Quote Link to comment https://forums.phpfreaks.com/topic/31632-php-mysql-5-star-rating-system-and/ Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 Funnily enough there is a tutorial on our [url=http://www.phpfreaks.com/tutorials/9/0.php]main site[/url] that covers this exact topic. Quote Link to comment https://forums.phpfreaks.com/topic/31632-php-mysql-5-star-rating-system-and/#findComment-146635 Share on other sites More sharing options...
redarrow Posted December 23, 2006 Share Posted December 23, 2006 here is a easy example as the tutoral has some fixing to be done but the concept is the same all you do is add the stars to a folder in this example it a folder called stars then you connect to the database then the corresponding database number from a table will echo the correct stars good luck.[code]<?php session_start();$db=mysql_connect("localhost","name","password");mysql_select_db("what_ever",$db);$query="select * from users_info_table where id='$id'";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){ $num=$record['number'];if($num=='1'){$stars="<img src='stars/stars1.png'></img>";}elseif($num=='2'){$stars="<img src='stars/stars2.png'></img>";}elseif ($num=='3'){$stars="<img src='stars/stars3.png'></img>";}elseif($num=='4'){$stars="<img src='stars/stars4.png'></img>";}elseif($num=='5'){$stars="<img src='stars/stars5.png'></img>";}echo $stars;}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31632-php-mysql-5-star-rating-system-and/#findComment-146807 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.