Sunday, January 22, 2012

CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?

Hello,

I'm using the CakeDC search plugin.

How can I search with a Like query in two different fields in the
database using just one form field?

For instance, a user goes to the form, enters in their search term,
this term will be checked if there's a Like query match in both the
entry1 field or the entry2 field.

I was trying this in the model:

public $filterArgs = array(
array(
'name'=>'entry1',
'type'=>'like',
'field'=>'Model.entry1 OR Model.entry2')
);

But this only seems to search from the last Model.entry2 field, it
doesn't search in entry1. I see the query search type, but I'm unclear
how to go about constructing it properly.

Thanks for any help.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: