Hello,
I'm extremely new to PHP, in fact this is my second day learning it. Hopefully not a really dumb question, I would have searched but I didn't know how to describe it.
Basically, I want to search and display results in a table, with the totals at the top of the table. I can only figure out how to put it at the bottom. Here's what I have so far (still incomplete, just testing/learning):
$totalbscore=0;
$i=0;
while ($i < $num) {
$season=mysql_result($result,$i,"season");
$date=mysql_result($result,$i,"date");
$dayofweek=mysql_result($result,$i,"dayofweek");
$monthday=mysql_result($result,$i,"monthday");
$homeaway=mysql_result($result,$i,"homeaway");
$opponent=mysql_result($result,$i,"opponent");
$wl=mysql_result($result,$i,"wl");
$bscore=mysql_result($result,$i,"bscore");
$oscore=mysql_result($result,$i,"oscore");
$bhighscorer=mysql_result($result,$i,"bhighscorer");
$bhighscore=mysql_result($result,$i,"bhighscore");
$bhighrebounder=mysql_result($result,$i,"bhighrebounder");
$bhighrebounds=mysql_result($result,$i,"bhighrebounds");
$ohighscorer=mysql_result($result,$i,"ohighscorer");
$ohighscore=mysql_result($result,$i,"ohighscore");
$attendance=mysql_result($result,$i,"attendance");
$rownumber=$i + 1;
$totalbscore=$totalbscore + $bscore;
if ($rownumber%2 == 0){
$rowclass = "class=row2";
}Else {
$rowclass = "class=row1";
}
echo "<tr>
<td $rowclass align=center><span class=gensmall>$rownumber</span></td>
<td $rowclass align=center><span class=gensmall>$season</span></td>
<td $rowclass align=center><span class=gensmall>$dayofweek $monthday</span></td>
<td $rowclass align=center><span class=gensmall>$homeaway $opponent</span></td>
<td $rowclass align=center><span class=gensmall>$wl $bscore-$oscore</span></td>
<td $rowclass align=center><span class=gensmall>$bhighscorer-$bhighscore</span></td>
<td $rowclass align=center><span class=gensmall>$bhighrebounder-$bhighrebounds</span></td>
<td $rowclass align=center><span class=gensmall>$ohighscorer-$ohighscore</span></td>
<td $rowclass align=center><span class=gensmall>$attendance</span><br></td></tr>";
$i++;
}
$bscoreavg = $totalbscore / $num;
echo "</table></td></tr></table><br><span class=gensmall>$num $totalbscore $bscoreavg</span>";
If I put the totals above the loop, it won't work right. What should I do?
Thanks for any help!