?> </th> <th align="center"><?php echo l('Top Player'); ?> </th> <th align="center"><?php echo l('Top Clan'); ?> </th> </tr> <?php while ($gamedata = $queryAllGames->fetch_assoc()) { # get the top player $playersObj = new Players($gamedata['code']); $topplayer = $playersObj->topPlayer(); $queryTopClan = $DB->query("SELECT\n\t\t\t\t\tc.clanId,\n\t\t\t\t\tc.name,\n\t\t\t\t\tAVG(p.skill) AS skill,\n\t\t\t\t\tCOUNT(p.playerId) AS numplayers\n\t\t\t\tFROM `" . DB_PREFIX . "_Clans` AS c\n\t\t\t\tLEFT JOIN `" . DB_PREFIX . "_Players` AS p\n\t\t\t\t\tON p.clan = c.clanId\n\t\t\t\tWHERE c.game = '" . $DB->real_escape_string($gamedata['code']) . "'\n\t\t\t\tGROUP BY c.clanId\n\t\t\t\tHAVING skill IS NOT NULL AND numplayers > 1\n\t\t\t\tORDER BY skill DESC\n\t\t\t\tLIMIT 1\n\t\t\t"); if (SHOW_DEBUG && $DB->error) { var_dump($DB->error); } $topclan = false; if ($queryTopClan->num_rows === 1) { $topclan = $queryTopClan->fetch_assoc(); } ?> <tr> <td> <a href="<?php echo "index.php?game=" . $gamedata['code']; ?> "><img src="hlstatsimg/game-<?php