Filtering SQL with 2 variables
Im trying to filter my db with 2 variables in the sql im using "project_category" to filter what category it is and "fieldset_Category_Category" to filter it down further. the code i have came out as follows
$colname_Recordset1 = "-1";
if (isset($_GET['project_category'])) {
$colname_Recordset1 = $_GET['project_category'];
}
$year_Recordset1 = "-1";
if (isset($_GET['fieldset_Category_Category'])) {
$year_Recordset1 = $_GET['fieldset_Category_Category'];
}
$query_Recordset1 = sprintf("SELECT * FROM project WHERE project_category LIKE %s AND fieldset_Category_Category <> %s ORDER BY id ASC", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"),GetSQLValueString($year_Recordset1, "int"));
when i run the code i get all tables when it should limited not sure if im going about it right or not. Im also sending the variables like this "?project_category=Leaseback&year=2011-2125". I know the first part works perfectly but the second variable is messing it up and not narrowing it down.
thanks in advance