Hi folks,
I have an SQL retrieve from a database which is working fine. One part of it goes like this:
... SUM( reviews.review_rating ) / COUNT( products.product_id ) AS review_rating...
When I run the SQL query in PHPMyAdmin, the results are returned fine as numeric values with 2 decimal places.
In the code, I do the following:
while ( $row = mysql_fetch_assoc($result) ) {
$review_rating = $row["review_rating"];
I would expect $review_rating to have a value of, for example, 7.00 or 8.50.
But it's a string with value 7 or 9.
Can anyone point me in the direction of this error, please?
PHP Version 4.3.11
MySQL 4.0.21
Thanks.