Try this

$conditions = 'Practitioner.name LIKE "%'..'%"';
$conditions .= ' OR Practitioner.surname LIKE "%'..'%"';
$record = $this->Practitioner->find('all', array('conditions'=>
$conditions ));


On Jun 17, 10:35 am, mthabisi mlunjwa <[email protected]> wrote:
> I'm not sure if I'm missing something here. I'm trying to come up with
> this sql statement the Cakephp way:
>
> select * from practitioners where name like 'Vermeulen' or surname
> like 'Vermeulen';
>
> This is what I've come up with:
>
> find( 'all', $conditions = array("OR"=>array('Practitioner.surname
> LIKE' => "%"Vermeulen"%",'Practitioner.name LIKE' =>
> "%"Vermeulen"%")));
>
> This works but it only outputs the whole database. I just want it to
> output practitioners with surnames or names like Vermeulen.
>
> Please help, thanks in advance.

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to