search results show all results from table if feild is left
Posted: Sun Jul 19, 2009 5:03 am
Hi,
i am stuck with this search code ....
the problem is: i want to allow users to leave empty feilds in search form for first_name, last_name and family_name. but when a user leave any feild empty then search shows all data from table. all what i want is, that if user leaves any feild empty then it must not include for search parameters.
can anyone please guid me where i am wrong or what should i do.
(please let me know if i have not explained properly)
Regards,
i am stuck with this search code ....
Code: Select all
$query = " SELECT * FROM table WHERE
fisrt_name LIKE '$first_name%'
OR last_name LIKE '$last_name%'
OR family_name LIKE '$family_name%'
";can anyone please guid me where i am wrong or what should i do.
(please let me know if i have not explained properly)
Regards,