setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Get the division from the page $division = $_GET["division"]; // If we want all the data, we don't need to select a division in the SQL query if ($division == "all") { $sqlGetTourneyInfo = $conn->prepare("SELECT tournamentUID,tournamentName,tournamentDate,tournamentDivision,numPlayers,winningTeamName,winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " ORDER BY tournamentDate DESC LIMIT $tourneyCardLimit"); } else { $sqlGetTourneyInfo = $conn->prepare("SELECT tournamentUID,tournamentName,tournamentDate,tournamentDivision,numPlayers,winningTeamName,winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " WHERE tournamentDivision='" . $division . "' ORDER BY tournamentDate DESC LIMIT $tourneyCardLimit"); } $sqlGetTourneyInfo->execute(); } catch (PDOException $e) { // failed connection echo "Connection failed: " . $e->getMessage(); } $tourneyResults = $sqlGetTourneyInfo->fetchAll(PDO::FETCH_ASSOC); ?> no title
format('M j, Y'); echo ("

$tourneyName

$tourneyDate

$winningTeamName

$division

$winner1

" . $numPlayers . "v" . $numPlayers . "

"); if ($numPlayers >= 2) { echo "

$winner2

"; } echo "

"; if ($numPlayers >= 3) { echo ("

$winner3

"); } if ($numPlayers == 4) { echo ("

$winner4

"); } echo ("

 

"); } ?>