In my project i have implement search option. Where we user should have to capability to search based on four fields namely “Zip, Street, City and State”. But none of these fields are mandatory.
I am confused with what conditions should i place in find().
So please help me.
I’m assuming that you’re having trouble because the form fields are optional, and you’re not sure how to build the
conditionsfor your find. Here’s a simple way:Finally, you can append the conditions either strictly:
Or, loosely:
The second form places the OR operand between your WHERE conditions so that it returns any particular match. Start off here and increase the complexity of the search slowly.