Added "all" to years display to show ALL results
This commit is contained in:
parent
2f57207109
commit
491c34cc93
@ -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
|
||||
|
@ -211,6 +211,7 @@ session_start();
|
||||
?>
|
||||
</select>
|
||||
<select size="1" name="year" id="year" onchange="refreshDisplay()">
|
||||
<option value="all">All</option>
|
||||
<?php
|
||||
// This uses the years we grabbed earlier and ensures we're only showing
|
||||
// the years we have entries for
|
||||
|
@ -1,19 +1,27 @@
|
||||
function refreshDisplay() {
|
||||
// Grab the division buttons by their name
|
||||
var divisionButtons = document.getElementsByName("division");
|
||||
var currentDivision = "";
|
||||
|
||||
// Loop through the division buttons and see which one is checked
|
||||
// Set the current division to that option
|
||||
for (var i = 0; i < divisionButtons.length; i++) {
|
||||
if (divisionButtons[i].checked) {
|
||||
currentDivision = divisionButtons[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
var displayDiv = document.getElementById("divisionDisplay");
|
||||
// If we set 'years' to all, then we should show all months too.
|
||||
// This is effectively a "show all" setting
|
||||
if (document.getElementById("year").value == "all") {
|
||||
document.getElementById("month").value = "all";
|
||||
}
|
||||
|
||||
// Grab the current division from the page
|
||||
document.getElementById("divisionDisplay").innerHTML = currentDivision;
|
||||
console.log(currentDivision);
|
||||
|
||||
var html = "";
|
||||
|
||||
var html = ""; // placeholder for webpage
|
||||
var image = ""; //get trophy image
|
||||
html += "<div class=\"divisionPanel\">";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user