I have been given this assignment, to include some sort of filtering to my current SQL query via User Input. Basically, i am looking for a filtering option, whether its some kin
You can do that simply by introducing if else statement
$where = "";
//receive filter option example $_GET['week']
//Do some sanitizing for $_GET['week']
if ($_GET['week']) {
$where = "WHERE Test_Database.Week = $_GET['week']"
} else if (somecondition) {
$where = "some query";
}
//You can add multiple condition by concatenating $where, but make sure where not repeats
$query = "SELECT TOP 10 Test_Database.Distributor, Test_Database.Value
FROM Test_Database
$where
GROUP BY Distributor
ORDER BY Value desc "