hi,
i'm wondering, is it possible to search by multiple fields at the same time
let me re-phrase that, i know it is possible BUT (and i dont know the correct terminology here) can i search by something in the URL too?
here is my code:
$result = mysql_query("SELECT * FROM adverts WHERE (ad_type = 'standard') AND (category = '$_GET[cat]') AND (i_condition = '$_GET[cond]') ORDER BY item_id DESC")
or die(mysql_error());
this page returns all that meet the critera of "category" and "i_condition" BUT if one is returned as null, i.e '' then any from the table that arent null are not returned. i hope i have explained this easy to understand.
basically what i want to know is, if a value in the url is null (meaning nothing for that field should be searched for) how can i have it return all the results for the other url search fields?
oh god i hope this makes sense.
another example:
/category_pages/full_cat.php?cat=entertainment
/category_pages/full_cat.php?cat=entertainment&cond=new
in the first link "cond" is not being searched for so i would want all fields returned that just have the matching "cat"
in the second i would want to filter by both, so my question is, in the first example how can i set the code (php above) to just ignore it for the time being unless the "cond" part is in the url?
any help appreciated thanks