query(" SELECT cdb_series.name, series, IFNULL( MAX(maxpoints), '?' ) AS `max`, COUNT(*) AS `count`, SUM(recapurl IS NOT NULL) AS `recapped`, DATE_FORMAT( MIN(broadcastDate), '%b %Y' ) AS `from`, DATE_FORMAT( MAX(broadcastDate), '%b %Y' ) AS `to`, MAX(IF(points1>points2,points1,points2)) AS `topscore`, IFNULL( cdb_players.name, '' ) AS `winner` FROM `cdb_games` INNER JOIN cdb_series ON cdb_games.series = cdb_series.id LEFT JOIN cdb_players ON cdb_series.winner = cdb_players.id WHERE cdb_series.status=0 GROUP BY cdb_games.series ORDER BY -cdb_series.rank" ); $s = ""; while ($series = mysqli_fetch_array($seriesq)) { $s .= ""; } $s .= "
Series Broadcast Winner
" . $series['name'] . " " . $series['from'] . " " . $series['to'] . " " . htmlspecialchars($series['winner']) . "
"; return $s; } $content = tig('div'); $content->add(tig('p') ->add( 'Welcome to CDB, the world\'s most comprehensive database of games, ' . 'facts and figures related to Channel 4\'s game show Countdown. ' . 'To discuss these games, try our message board, C4Countdown.co.uk; if you\'d like to play the game for yourself, head to apterous.org')); $content->add(tig('h2', 'Series')); $content->add(getSeriesTable($GLOBAL_CONN)); echo getPage('Welcome', 'index.php', $content); ?>