From 491c34cc9318a9e09e7d27862be8b255aecfdb2d Mon Sep 17 00:00:00 2001 From: Taylor Courage Date: Fri, 7 Mar 2025 22:20:28 -0500 Subject: [PATCH] Added "all" to years display to show ALL results --- display/division_results.php | 12 +++++++++--- display/general_results.php | 1 + scripts/results.js | 14 +++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/display/division_results.php b/display/division_results.php index abdd2d0..4fc5395 100644 --- a/display/division_results.php +++ b/display/division_results.php @@ -18,12 +18,18 @@ try { // Try opening the SQL database connection } else { $getMonth = "MONTH(tournamentDate)=\"" . $_GET["month"] . "\" AND "; } - // Grab year and division - $year = $_GET["year"]; + // Grab year similar to above + if ($_GET["year"] == "all") { + $getYear = ""; + } else { + $getYear = "YEAR(tournamentDate)=\"" . $_GET["year"] . "\" AND "; + } + + // Grab division $division = $_GET["division"]; // Select all the winners from the table where the month, year, and division all match - $sqlGetTopWinnersList = $conn->prepare("SELECT winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " WHERE $getMonth YEAR(tournamentDate)=\"" . $year . "\" AND tournamentDivision=\"" . $division . "\""); + $sqlGetTopWinnersList = $conn->prepare("SELECT winner1,winner2,winner3,winner4 FROM " . $tournamentDataTableName . " WHERE $getMonth $getYear tournamentDivision=\"" . $division . "\""); $sqlGetTopWinnersList->execute(); // Fetch the results diff --git a/display/general_results.php b/display/general_results.php index 9775d50..078f1ed 100644 --- a/display/general_results.php +++ b/display/general_results.php @@ -211,6 +211,7 @@ session_start(); ?>