Here is my problem. I have a table that produces 11 names with 2 values for each. These values are derived by subtracting one field in the database from the other. I have no problem gettign the table to produce those 22 values, but now I want to total each column of 11, but I dont know how. Here is my code
$result = mysql_query("SELECT * FROM stats1011 where 2A = '$G2' OR 2B = '$G2' order by field(pos,'LW','C','RW','D','G'), Last ASC")
or die(mysql_error());
?>
<?php
echo "<table width='150' border='1' cellspacing='0' cellpadding='1' bgcolor='ffffff'>";
echo "<tr>
<tr bgcolor='000000'>
<td align='center'colspan='5'><img src='/images/bar_$G2.jpg' width='150' height='19' border='0'></td>
</tr>
<tr>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>P</b></td>
<td align='left' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>Player</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>TM</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>GP</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>PTS</b></td>
</tr>
";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td align='center' bgcolor='FFFF99'><font face='arial' size='1' color='000000'><b>";
echo $row['Pos'];
echo "</b></td><td align='left' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
echo $row['Last'];
echo "</td><td align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
echo $row['Team'];
echo "</td><td align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
$gp_gain=$row['GP1011_wk2']-$row['GP1011_wk1'];
if ($gp_gain < 0)
echo 0;
else echo $row['GP1011_wk2']-$row['GP1011_wk1'];
echo "</td><td align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
$pts_gain=$row['PTS1011_wk2']-$row['PTS1011_wk1'];
if ($pts_gain < 0)
echo 0;
else echo $row['PTS1011_wk2']-$row['PTS1011_wk1'];
You can see my progress at: