Creating a search query which ignore null values
Posted: Mon Sep 18, 2006 7:19 am
Hello Experts,
In our php application we are trying to code a search process where in we need to extract data from a table , the user can enter one or more fields listed in the link below
http://www.strokefx.com/4ss-7Aug06/ibs/ ... earch.html .
The user may enter one or more fields,but if we use 'like' clause its retrieving all the records, can somebody guide me in coding a efficient MySQL query which ignores null fields (the fields which are left blank in the above form) and retrieves only those records whose values have been entered in the form fields.
Tried out 'ifnull()' mysql function but its not helpful.
Thx in advance!
Regards,
Swiftguy.
In our php application we are trying to code a search process where in we need to extract data from a table , the user can enter one or more fields listed in the link below
http://www.strokefx.com/4ss-7Aug06/ibs/ ... earch.html .
The user may enter one or more fields,but if we use 'like' clause its retrieving all the records, can somebody guide me in coding a efficient MySQL query which ignores null fields (the fields which are left blank in the above form) and retrieves only those records whose values have been entered in the form fields.
Tried out 'ifnull()' mysql function but its not helpful.
Thx in advance!
Regards,
Swiftguy.