0'; // // Filtering // //Did the user specify a Name filter? if (isset($config['filterName']) and $config['filterName'] != "Ignore") { //Append name filtering to the query: $query .= ' AND Name LIKE "%' .$config['filterName'] .'%"'; } //Did the user specify a Minimum Level filter? if (isset($config['filterMinLvl']) and $config['filterMinLvl'] != "Ignore") { //Append name filtering to the query: $query .= ' AND Level >=' .$config['filterMinLvl'] .''; } //Did the user specify a Maximum Level filter? if (isset($config['filterMaxLvl']) and $config['filterMaxLvl'] != "Ignore") { //Append name filtering to the query: $query .= ' AND Level <=' .$config['filterMaxLvl'] .''; } // // Sorting // //Check is sorts are specified: $toldSort1 = isset($config['sortBy']) and $config['sortBy'] != "Ignore"; $toldSort2 = isset($config['sortBy2']) and $config['sortBy2'] != "Ignore"; $toldSort3 = isset($config['sortBy3']) and $config['sortBy3'] != "Ignore"; //Create a variable to store whether or not at least one sort is specified. $anySort = 1; //Was the first sort specified? if ($toldSort1) { //Append proper sorting to the query: $query .= ' ORDER BY ' .$config['sortBy']; //Confirm for later that at least one sort was given. $anySort = 1; } //Was the second sort specified? if ($toldSort2) { //Append proper sorting to the query: $query .= ' ORDER BY ' .$config['sortBy']; //Confirm for later that at least one sort was given. $anySort = 1; } //Was a third sort specified? if ($toldSort3) { //Append proper sorting to the query: $query .= ' ORDER BY ' .$config['sortBy3']; //Confirm for later that at least one sort was given. $anySort = 1; } //Were any sorts filled out? if ($anySort = 1) { //Append a name sorting at the end: $query .= ', Name'; } else { //Append a name sorting at the end: $query .= ' ORDER BY Name'; } ?>