Im building a table that will show cumulative stats for a given set of teams. First off, Im displaying the teams in a while statement. That works. Now as each row is written I want to populate the fields for each field. I think if I can get one field to work that I can do the rest so I will just detail the first field.
The first field is results_numfish. It is an integer field so I think Im ok there. I cannot get the sum to show up for each teams id. As each row is populated it should see the team_id and then perform the SUM query and then ouput that info in that section of the table. Any help would be great.
$result6 = $db->sql_query("select * from ".$prefix."_tourn_teams where div_id='$division_id'");
$place = 1;
while(list($team_id, $div_id, $partner1_firstname, $partner1_lastname, $partner2_firstname, $partner2_lastname) = $db->sql_fetchrow($result6)) {
echo "<TR><TD WIDTH=\"100%\" colspan=\"8\"><B>$partner1_firstname $partner1_lastname / $partner2_firstname $partner2_lastname</B></TD>"
."</TR><TR bgcolor=\"e6e6e6\">"
."<TD WIDTH=\"102\" ALIGN=\"CENTER\">$place</TD>";
$query = "select SUM(results_numfish) as numfish from ".$prefix."_tourn_results GROUP BY team_id HAVING $team_id";
list($numfish) = mysql_query($query);
echo "<TD WIDTH=\"102\" ALIGN=\"CENTER\">$numfish</TD>";
//}
echo "<TD WIDTH=\"72\" ALIGN=\"RIGHT\"></TD>"
."<TD WIDTH=\"80\" ALIGN=\"CENTER\"></TD>"
."<TD WIDTH=\"80\" ALIGN=\"CENTER\"></TD>"
."<TD WIDTH=\"80\" ALIGN=\"CENTER\"></TD>"
."<TD WIDTH=\"102\" ALIGN=\"CENTER\"></TD>"
."<TD WIDTH=\"76\" ALIGN=\"RIGHT\"></TD></TR>";
$place++;
}