Hey folks,
I have never used avg() before and am puzzled by the result I am getting.
SQL code
plus php code
gives me the expected rows as follows
68 = 0.30
67 = 0.30
66 = 0.30
65 = 0.30
64 = 0.32
However, the SQL
plus PHP
gives me
"The average of the 5 readings is 0.332941"
The actual average is .304 What am I doing wrong?
Steve
- I have fun with telemarketers
I have never used avg() before and am puzzled by the result I am getting.
SQL code
Code:
SELECT * FROM s12345 ORDER BY id DESC LIMIT 5
plus php code
Code:
do{
echo $row_trend["id"] . " = " . $row_trend["height"]. "<br>";
}while($row_trend = mysql_fetch_assoc($trend));
gives me the expected rows as follows
68 = 0.30
67 = 0.30
66 = 0.30
65 = 0.30
64 = 0.32
However, the SQL
Code:
SELECT avg(height) as avg FROM s12345 ORDER BY id DESC LIMIT 5
plus PHP
Code:
echo "<div>The average of the 5 readings is " . $row_trend["avg"];
gives me
"The average of the 5 readings is 0.332941"
The actual average is .304 What am I doing wrong?
Steve
- I have fun with telemarketers