PHPMyAdmin says that the [6] value in this array (the value for rating) should be 3.5 .
However, as you can see, the query returns a 0.
What is going on here.
Does anyone know what might cause this?
Here is the PHP code used to access and display the data:
(I have removed parts of code because it is unimportant. So don't worry about undefined variables you see.)
and here is the result I get:
What's going on here?
However, as you can see, the query returns a 0.
What is going on here.
Does anyone know what might cause this?
Here is the PHP code used to access and display the data:
(I have removed parts of code because it is unimportant. So don't worry about undefined variables you see.)
| Code: |
|
<?php $con = mysql_connect("localhost","foo","bar"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("foobar", $con); $result = mysql_query("SELECT * FROM news WHERE id = '$id'"); $Crating = mysql_fetch_row($result); if($Crating[6] = 0){ $newrating = $Urating; } else{ $newrating = (($Urating + $Crating[6])/2); } print_r($Crating); ?> |
and here is the result I get:
| Code: |
|
Array ( [0] => 74 [1] => 2007-10-03 19:37:22 [2] => Woa. [3] => [article text is here] [4] => Author [5] => 3 [6] => 0 ) //[6] is supposed to be the rating. This value is supposed to be 3.5 right now... |
What's going on here?
