Hi,
I have a weird prob with mysql. In the following query it seems to add one to the result. For example, on an item that has not been voted on and somebody rates a 3, the following code will produce:
You gave this song a 3, changing its score to 4.00. If I brows the table it shows the vote as 3.
$getRat = "SELECT AVG(votes) AS rating FROM svotes WHERE songid = '$songid'";
$grating = mysql_query($getRat, $conn) or die(mysql_error());
$newrating = mysql_result($grating,0);
$newrating = number_format($newrating ,2);
echo "You gave this song a $rating, changing its score to $newrating";
I currently have the mysql vote row set to
enum('0', '1', '2', '3', '4', '5').
Should I just be using INT? What else could be causing this?
Thanks alot.