I'm fairly new to PHP and MYSQL, and I'm trying to get some code to work, and it isn't. I'm trying to calculate the average value of x amount of row data, where both the # of rows and amount of data will be constantly increasing.
The data I have in a mysql db contains a field, Overall, which relates to the overall score that a given item received.
The # of items will continue to grow and, as such, so will the number of cells that contain data for that field.
There are also multiple items under the same manufacturer, and I want the average to be calculated for each manufacturer.
My attempt at the code goes something like this
CODE
$query = SELECT SUM(Overall) FROM <table name> WHERE Manufacturer = <value>;
$result = @mysql_query ($sum);
$query = SELECT COUNT(Overall) FROM <table name> WHERE Manufacturer = <value>;
$result = @mysql_query ($total);
$average = $total / $sum;
echo $average;
Please help!
[mod edit] added code tags.