I don't know for others but generally i build up a query depending on the input.
example : (for the sake of the example some parts will be missing though)
you have 3 inputs : player name, player min level, player max level.
$playername = (isset($_POST['playername'])) ? $_POST['playername'] : null; // this line checks if the player name was posted if yes then put the post in the variable $playername else null
$minlevel = (isset($_POST['minlevel'])) ? $_POST['minlevel'] : null; // same with min level
$maxlevel = (isset($_POST['maxlevel'])) ? $_POST['maxlevel'] : null; // same thing
$searchquery = 'SELECT name, level, whatever FROM tableplayer ''; // start the search query
// Now we will start the conditional query !
if ($playername) {
$searchquery .= ' WHERE name LIKE "%'.$playername.'%" ';
}
else {
$searchquery .= ' WHERE name LIKE "%" ';
}
if ($minlevel) {
$searchquery .= ' AND level >='.$minlevel ';
}
if ($maxlevel) {
$searchquery .= ' AND level <='.$maxlevel ';
}
$searchquery .= ' LIMIT 20';
//execute query retrieve recordset etc etc etc...
The rest should be easy enough and depending on the number of inputs you will have to add more conditions to your query. Note that this example does NOT sanitize the inputs it merely checks that something was posted so don't use it "as is". Apart from the first condition that is mandatory (you need a WHERE close at least), the rest of the conditions will construct or not the query if needed.
Hope it helps
