if(isset($submit))
{
// Our initial SELECT query - we will build on to it.
$sql = "SELECT * FROM link_information AS I, link_categories AS C";
$where[] = ' C.categoryID=I.categoryID ';
// If it's not "Any" then add on a where claus
if($f['category' != 'all')
{
$where[] = ' I.categoryID='.$f['category'];
}
// If "hits" is a valid number then add on a where clause
if(isset($f['hits_compare']) && strlen($f['hits_limit']))
{
$where[] = ' I.hits '.$f['hits_compare'].' '.$f['hits_limit'];
}
You can also add "ORDER BY" clauses with ease and the ability to choose which columns to perform those "ORDER BY"
cluases on. In the grand scheme of things users are wanting not only more customization but better search results
then they go to your webpages. Giving them the power of a SQL console in their browser will bring them one step
close to their goal.