Jump to content

Help with PHP and data from myslq database


fernando68

Recommended Posts

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.... >:(:(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.