Below is a portion of the code I use to grab stats from my hockey team database. Using this, I can display the entire roster's career stats for Goals, Assists, Points and Games Played.
Now I'm trying to figure out how to compare all the stats, and pull out say "the leading goal scorer" and display his name and total career goals. But I'm not sure to how to do this? Any thoughts?
Thanks,
Greg
$totalslist = mysql_query('SELECT name, SUM(goals) AS totalgoals, SUM(assists) AS totalassists, SUM(gamesplayed) AS totalgamesplayed, SUM(goals)+SUM(assists) AS totalpoints
FROM players, statistics, season WHERE playerid=players.id AND seasonid=season.id GROUP BY players.id ORDER BY ' . $order . $direction);
while ($players = mysql_fetch_array($totalslist)) {
$name = $players['name'];
$totalgoals = $players['totalgoals'];
$totalassists = $players['totalassists'];
$totalgamesplayed = $players['totalgamesplayed'];
$totalpoints = $totalgoals + $totalassists;




Bookmarks