I have a table with more than 10 columns (PUB, ID, PG_NO, SECTION, EDITION, COLOR, REVISION). i put a form with 7 fields and action as post. I can filter data with sql command like:
#mysql_select_db(“mydb”, $con);
$sql=“SELECT * FROM files WHERE PUB LIKE '”.$PUB."’ AND
ID LIKE ‘".$ID."’ AND PG_NO LIKE ‘%".$PG_NO."%’ AND
SECTION LIKE ‘".$SECTION."’ AND EDITION LIKE ‘%".$EDITION."%’ AND
COLOR LIKE ‘".$COLOR."’ AND REVISION LIKE ‘".$REVISION."’";#
The problem is I have to fill every field of search/filter query. I want to sometimes use all the fields and only some of the fields in other times.
Is there any way that I can filter with only 1 or 2 filter criteria and rest filters are left blank to show all corresponding data?
thanks in advance