fernando68 Posted January 18, 2009 Share Posted January 18, 2009 hi guys, I have a little problem with this database. I want to put an star rating system on my site and found this script that seems to do the job. I have installed it and it displays the stars and visitors can cast a vote from 1 to 5 and this data (vote, visitor Ip, url of .php file, date) is stored in a mySql database. the problem is I can´t retrieve the data stored in the database... I am going nuts with this cuz not working!!!! ??? The script can be seen workin at this url: http://www.guideall.com/hsrs/0rating.php The part that is givin all the trouble is the following: include "$hm/auth/config.php"; //this works ok, since script saves every votes in the database $link = mysql_connect($hostname, $username,$password); if($link) { $dbcon = mysql_select_db($dbname,$link); } //averaging rating // THE FREAKING PROBLEM STARS HERE $qur1 = "select count(*) as dd, avg(rateval) as xx from hsrs where url='$url' group by url"; // CANT RETRIVE DATA HERE !! $result1 = mysql_query($qur1,$link); mysql_fetch_array($result1, MYSQL_ASSOC); echo sizeof($result1); // I CANT REACH THIS CONDITION, BECAUSE CANT RETRIVE THE DATA if($line = @mysql_fetch_array($result1, MYSQL_ASSOC)) { $count = $line['dd']; $rateval = $line['xx']; } ?> I need help`........ I am going to bed at 4 am for a week working and this and not working.... Quote Link to comment https://forums.phpfreaks.com/topic/141312-help-with-php-and-data-from-myslq-database/ Share on other sites More sharing options...
MadTechie Posted January 19, 2009 Share Posted January 19, 2009 change $result1 = mysql_query($qur1,$link); to $result1 = mysql_query($qur1,$link) or die("ERROR: $qur1".mysql_error()); it won't fix it but will tell you the problem.. post the results back here if your still not sure Quote Link to comment https://forums.phpfreaks.com/topic/141312-help-with-php-and-data-from-myslq-database/#findComment-740152 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.