function search($item = null) {
                 $item = $this->params['url']['q'];
        $recipes = $this->Recipe->find('all', array('conditions' => array(
'OR' =>array(
 array('Recipe.name LIKE' => '%' . $item . '%',
 array('Recipe.caption LIKE' => '%' . $item . '%')))),

                                                    'order' =>
'Recipe.name',
                                                   
                                                     'recursive' => 1,
                                                   ));

i tried put wont give the results as u can see above 

when i put individual it work lets say  Recipe.ingredients LIKE
its show the the result good but only ingredients but i want both 


thank you very much appreciated 













brian-9 wrote:
> 
> 
> try
> 
> 'conditions' => array(
>     'OR' => array(
>         array('Recipe.name LIKE' => '%' . $item . '%'),
>         array('Recipe.ingredients LIKE' => '%' . $item . '%')
>     )
> )
> 
> On Thu, Feb 5, 2009 at 10:34 AM, monirr444 <[email protected]> wrote:
>>
>>
>> function search($item = null) {
>>                $item = $this->params['url']['q'];
>>                $recipes = $this->Recipe->find('all', array('conditions'
>> =>
>> array('Recipe.name LIKE' => '%' . $item . '%'),
>>                                                    'order' =>
>> 'Recipe.name',
>>                                                    'recursive' => 1,
>>                                                   ));
>>
>>                //var_dump($recipes);
>>
>>                if (!$item) {
>>                        $this->Session->setFlash(__('No Search Items
>> Found',
>> true));
>>                        $this->redirect(array('action'=>'index'));
>>                }
>>
>>                $this->set('search', $recipes);
>>        }
>>
>> this is my  public website search when ever i search it give me results
>> by
>> name
>> how to put 2 condations  so it search by name and ingredients
>> i used "OR" but didnt work maybe i used it worng
>> like this
>>
>> "array('Recipe.name LIKE' => '%' . $item . '%'), "
>> "array('Recipe.ingredients LIKE' => '%' . $item . '%'), "
>> i wanna 2 these whenever i search by name and ingredients it should give
>> both results
>> i looked the cake book i coudnt find any
>>
>> thank you so much
>> --
>> View this message in context:
>> http://n2.nabble.com/Help-with-Complex-Find-Conditions-tp2275441p2275441.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
>>
> 
> > 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Help-with-Complex-Find-Conditions-tp2275441p2276013.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to