![]() |
a question , alittle of math here
hi
whats the error here => PHP Code:
|
You mean in SQL or what? If SQL is your case...(MySQL for this matter):
Code:
SELECT SUM(column_name)/COUNT(column_name) |
thanks i did it but how to show to result ?
|
Please, you're going to have to provide more details. Your messages are vague at best. Also, please read some of the links I've provided in replies to your other threads.
|
it gives this error
Database error: Unknown column 'rate' in 'field list' even if in the table "rate" there is a column named "rate" |
You need to use an ALIAS on that result, e.g.
Code:
SELECT SUM(`rate`) / COUNT(`rate`) AS average_rate from `rate`This is why we ask you to be more specific; the query xenon provided by example works fine as-is in MySQL, but not if you want to return the value in PHP. I would also suggest, if you're retrieving only one column from a resultset, use mysql_result() instead of one of the mysql_fetch_* functions. You don't need an array, there is only a single row and single column result output. |
yeah i solve it thanks
|
| All times are GMT. The time now is 05:55 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0