Stats

"; print "$caption"; $result = mysql_query($query) or die(mysql_error()); $n = 1; while ($row = mysql_fetch_row ($result)) { $v = htmlspecialchars($row[0]); $p = round($row[1] / $row[2]); print "$n. $v$p"; $n++; } print ""; } $filter = '(stigma = 0 AND level < 99 AND level > 0)'; $result = mysql_query("SELECT COUNT(*), SUM(level), SUM(LEAST(level-1,1)) FROM pqhi WHERE $filter") or die(mysql_error()); $count = mysql_result($result, 0); $slugg = mysql_result($result, 0, 1); $elite = mysql_result($result, 0, 2); print "Pop. $count
($elite level 2 or higher)
"; print "Average Level: " . round($slugg/$count); $top = 5; $suffix = ",1 FROM pqhi WHERE $filter GROUP BY 1 ORDER BY c DESC LIMIT $top"; print "
"; showstats("Top $top Races by Popularity", "SELECT race, COUNT(*) AS c $suffix"); print ""; showstats("Top $top Races by Combined Level", "SELECT race, SUM(level) AS c $suffix"); print "
"; showstats("Top $top Classes by Popularity", "SELECT class, count(*) AS c $suffix"); print ""; showstats("Top $top Classes by Combined Level", "SELECT class, sum(level) AS c $suffix"); print "
"; showstats("Top $top Avatars by Popularity", "SELECT CONCAT(race,' ',class), count(*) AS c $suffix"); print ""; showstats("Top $top Avatars by Combined Level", "SELECT CONCAT(race,' ',class), sum(level) AS c $suffix"); print "
"; footer(); ?>