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); ?>
$tourneyDate
$winningTeamName
$division
" . $numPlayers . "v" . $numPlayers . "
"); if ($numPlayers >= 2) { echo ""; } echo ""; if ($numPlayers >= 3) { echo (" "); } if ($numPlayers == 4) { echo (" "); } echo (""); } ?>