'; } include 'pageheader.php'; /* Get total number of entrants */ $queryTotalEntrants = 'SELECT COUNT(DISTINCT EntrantID) FROM CompoGames'; $resultsetr = mysql_query($queryTotalEntrants, $dbconnect); $totalEntrants = 0; while($row = mysql_fetch_row($resultsetr)) { $totalEntrants = $row[0]; } /* Get total number of games */ $queryTotalCount = 'SELECT COUNT(*) FROM CompoGames'; $resultsetx = mysql_query($queryTotalCount, $dbconnect); $totalGames = 0; while($row = mysql_fetch_row($resultsetx)) { $totalGames = $row[0]; } /* Get total number of completed games */ $queryCompleteCount = 'SELECT COUNT(*) FROM CompoGames, CompoStatus WHERE CompoGames.StatusID = CompoStatus.ID AND CompoStatus.StatusPercent = "100%"'; $resultsetc = mysql_query($queryCompleteCount, $dbconnect); $totalComplete = 0; while($row = mysql_fetch_row($resultsetc)) { $totalComplete = $row[0]; } // Print page masthead print ''; print ''; print ''; print ''; // Build Base Query $queryBase = 'SELECT CompoGames.ID, CompoEntrant.BoardName AS Entrant, CompoGames.GameName AS Game, CompoPlatform.PlatformName AS Platform, CompoGenre.GenreName AS Genre, CompoStatus.StatusPercent AS Status, CompoGames.WebPage AS Links, CompoGames.OriginalPage AS URL2, CompoGames.CommentsPublic AS ShowComments FROM CompoGames, CompoEntrant, CompoPlatform, CompoGenre, CompoStatus WHERE CompoEntrant.ID = CompoGames.EntrantID AND CompoPlatform.ID = CompoGames.PlatformID AND CompoGenre.ID = CompoGames.GenreID AND CompoStatus.ID = CompoGames.StatusID'; $queryClause = ''; $queryOrder = ''; // Build Final Query if($genre != '') { $queryClause = ' AND GenreID = ' . $genre; } if($platform != '') { $queryClause = ' AND PlatformID = ' . $platform; } if($entrant != '') { $queryClause = ' AND EntrantID = ' . $entrant; } if($orderby != '') { if($orderby == 'Status') { $queryOrder = ' ORDER BY CompoGames.StatusID'; } else { $queryOrder = ' ORDER BY ' . $orderby; } if($ordertype != '') { $queryOrder .= ' ' . $ordertype; } if($orderby == 'Entrant') { $queryOrder = $queryOrder . ', Game ASC'; } } else { $queryOrder = ' ORDER BY Game, Entrant ASC'; } $querystr = $queryBase . $queryClause . $queryOrder; $resultset = mysql_query($querystr, $dbconnect); // Fetch Table Fields print ""; for($i = 1; $i < 7; $i++) { $columnName = mysql_field_name($resultset, $i); print ''; if($i < 6) { print ''; } else { print ''; } } print ""; // Loop Through Result Set $currRow = 1; $prevEntrant = ''; while($row = mysql_fetch_row($resultset)) { print ''; for($i = 1; $i < 7; $i++) { $columnName = mysql_field_name($resultset, $i); if($currRow == 1) { print ''; } print ''; $prevEntrant = $row[1]; $currRow = -$currRow; } print ''; print ''; print '
ENTRIES
' . $totalEntrants . ' Entrants - ' . $totalGames . ' Games - ' . $totalComplete . ' Completed
 
'; if($columnName != $orderby) { printSortLink($toolID, $columnName, '', $genre, $platform); } print $columnName; if($columnName != $orderby) { ''; } print ' '; print ''; printSortLink($toolID, $columnName, 'ASC', $genre, $platform); print 'Sort Ascending'; print ' '; printSortLink($toolID, $columnName, 'DESC', $genre, $platform); print 'Sort Descending'; print ' 
'; } else { print ''; } if($columnName == 'Game') { print ''; print ($row[$i] == '' ? ' ' : stripslashes($row[$i])); print ''; } else if($columnName == 'Entrant') { if($orderby == '' || $orderby == 'Entrant') { print ($row[$i] == $prevEntrant ? ' ' : stripslashes($row[$i])); } else { print $row[$i]; } } else if($columnName == 'Links') { if($row[$i] != null && $row[$i] != '') { print 'Remake Page '; } if($row[$i + 1] != null && $row[$i + 1] != '') { print 'Original Game Page '; } if($row[$i + 2] == 1) { print ''; print 'Comment On This Game'; print ' '; } print ' '; } else if($columnName == 'Status') { if($row[$i] != '[unknown]') { print ''; } else { print ' '; } } else { print ($row[$i] == '' ? ' ' : $row[$i]); } print '
 
WIP Page = Remake Page     Original Game Page = Original Game Page     Comments Allowed = Comments Allowed     Has Comments = Has Comments
'; include 'dbdisconn.php'; include 'pagefooter.php'; ?>