I am trying to do some count on a database and put them in order. Here is the code that i am useing
[code=php]
<?php echo $row_getSoccerScores[‘AgeGroup’]; ?>
</label>
<input name=”Year” type=”hidden” id=”Year” value=”<?php echo $row_getSoccerScores[‘Year’]; ?>” />
<input name=”Season” type=”hidden” id=”Season” value=”<?php echo $row_getSoccerScores[‘Season’]; ?>” />
</p>
<table width=”600″ border=”1″ align=”center”>
<tr>
<td><div align=”center”><strong>Game</strong></div></td>
<td nowrap=”nowrap”><div align=”center”><strong>Team</strong></div></td>
<td><div align=”center”><strong>Score</strong></div></td>
<td><div align=”center”><strong>Points</strong></div></td>
</tr>
<?php do { ?>
<tr>
<td><div align=”center”><?php echo $row_getSoccerScores[‘Week’]; ?></div></td>
<td nowrap=”nowrap”><p align=”center”><?php echo $row_getSoccerScores[‘HomeTeam’]; ?></p>
<p align=”center”> <?php echo $row_getSoccerScores[‘AwayTeam’]; ?></p></td>
<td><p align=”center”><?php echo $row_getSoccerScores[‘HomePointsScore’]; ?> <?php echo $row_getSoccerScores[‘HomwWinorLoss’]; ?></p>
<p align=”center”> <?php echo $row_getSoccerScores[‘AwayPointScore’]; ?> <?php echo $row_getSoccerScores[‘AwayWinorLoss’]; ?></p></td>
<td><p align=”center”><?php echo $row_getSoccerScores[‘HomePointsEarned’]; ?></p>
<p align=”center”><?php echo $row_getSoccerScores[‘AwayPointsEarned’]; ?></p></td>
</tr>
<?php $myhash[$row_getSoccerScores[‘HomeTeam’]] += $row_getSoccerScores[‘HomePointsEarned’] ;?>
<?php $myhash[$row_getSoccerScores[‘AwayTeam’]] += $row_getSoccerScores[‘AwayPointsEarned’] ;?>
<?php $myhash1[$row_getSoccerScores[‘AwayTeam’]] += $row_getSoccerScores[‘AwayPointsScore’] ;?>
<?php $myhash1[$row_getSoccerScores[‘HomeTeam’]] += $row_getSoccerScores[‘HomePointsScore’] ;?>
<?php $myhash2[$row_getSoccerScores[‘AwayTeam’]] += $row_getSoccerScores[‘HomePointsScore’] ;?>
<?php $myhash2[$row_getSoccerScores[‘HomeTeam’]] += $row_getSoccerScores[‘AwayPointsScore’] ;?>
<?php } while ($row_getSoccerScores = mysql_fetch_assoc($getSoccerScores)); ?>
</table>
<p>
</p>
<h1>Ranking</h1>
<table width=”600″ border=”1″>
<tr>
<td><div align=”center”>Rank</div></td>
<td><div align=”center”>Team Name</div></td>
<td><div align=”center”>Total Points Earned</div></td>
<td><div align=”center”>Total Scored Made</div></td>
<td><div align=”center”>Total Scored Allowed</div></td>
</tr>
<?php
$count = 0;
arsort ($myhash);
foreach ($myhash as $key => $value)
{ $count++; ?>
<tr>
<td><div align=”center”><?php echo $count; ?></div></td>
<td><div align=”center”><?php echo $key; ?></div></td>
<td><div align=”center”><?php echo $value; ?></div></td>
<td><div align=”center”><?php echo $myhash1[$key]; ?></div></td>
<td><div align=”center”><?php echo $myhash2[$key]; ?></div></td>
</tr>
<?php } ?>
</table>
Put for some reason the $myhash2 is not counting corretly. Is there another way of doing this