sundance1980
MIS
Hello I know this is probably one of the worst Query's you have every seen. I need some help because I really dont think this is right even though it works.
I am trying to find the sum of all my column in my mysql db.
Fields are hits at bats third base ....etc and I have an empty Average field that i play on doing hits/at bats =average.
This is my code:
I am trying to find the sum of all my column in my mysql db.
Fields are hits at bats third base ....etc and I have an empty Average field that i play on doing hits/at bats =average.
This is my code:
Code:
$result = mysql_query("SELECT SUM( h ) , SUM( ab ) , SUM( sb ) , SUM( tb ) , SUM( hr ) , SUM( bb ) , SUM( r ) , SUM( rbi ), SUM(h)/SUM(ab)
FROM stats");
$rs1=mysql_fetch_row($result);
$div_value = $rs1[8];
$average=sprintf("%.3f",$div_value);
echo"$average <br>" ;
echo "Total hit: $rs1[0] <br>
Total AB: $rs1[1] <BR>
$rs1[2] <br>
$rs1[3] <br>
$rs1[4] <br>
$rs1[5] <br>
$rs1[6] <br>
$rs1[7] ";
?>