'Cand.code_id' => $data provides Cand.code_id IN (1, 2, 3) that is equivalent to Cand.code_id = 1 OR Cand.code_id = 2 OR Cand.code_id = 3. So there is no need in OR. Query like "Cand.code_id = 1 AND Cand.code_id = 2 AND Cand.code_id = 3" is useless. So there is no need in AND. So what do you want?
On Apr 29, 3:39 pm, slippy <[email protected]> wrote: > Hi, > > I want to be able to choose if the find should do an AND or OR on a > find using an array but I can't get it to take the same array > > The way I have been able to do it is like this: > > //AND > $this->Cand->find('list',array( > 'conditions' => array('AND' => array('Cand.code_id' => array(38, 49))) > ); > //OR > $this->Cand->find('list',array( > 'conditions' => array('OR' => array('Cand.code_id' => 38, > 'Cand.code_id' => 49,)), > ); > > But is there a way of doing it like this: > > $this->Cand->find('list',array( > 'conditions' => array($conditional => array('Cand.code_id' =>$data)) > ); > > Thanks > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with > their CakePHP related questions. > > 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 > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
