How do you want to sum? Over the different tables? If any player is mentioned more than once (in multiple rows) of the same table, you should use a query like:
select playerid, sum(fgm), sum(fga) from 200001playerstats where playerid = $activeplayer group by playerid;
This should give you the sum of fgm and fga for 1 player in the table (eliminate "where playerid=...) to get the sums for all players).
To get the sums of fgm and fga for 1 player, just add up the values in your while-loop.
For instance:
$fgmtot=0;
$fgatot=0;
<your query code>
while($row=...)
{
extract($row);
$fgmtot=$fgmtot+$fgm; /*add up to the total*/
/*same for fgatot*/
$fgpct = $fgm / $fga;
$f_fgpct = sprintf("%.3f", $fgpct);
echo "$year $fgm-$fga ($f_fgpct)<br>";
}
If you want to have the sums for all players, you can modify like this:
-eliminate "where playerid=..." part from your queries
-use an array (assuming your playerids are numerical) of fgatot and fgmtot:
$fgmtot[$playerid]=$fgmtot[$playerid]+$fgm; or something like that.
After your queries, you can loop over the fgmtot and fgatot arrays (they now store the totals for each player, with playerid as index in the arrays).
I hope this helps.