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.
Creating a search query which ignore null values
Moderator: General Moderators
An example would be:
Code: Select all
select * from tbl_name where col0 IS NOT NULL