Just for the record (and to possibly save others from grief if they're
trying to do a LIKE in 1.2 RCx based on this example), it should be:
$conditions = array("or"=>(array(
'edifici LIKE ?' => "%$searchText%",
'adreca LIKE ?' => "%$searchText%"
)));
I'm sure Mariano just typed this off the cuff, as he's a core
developer and really knows his stuff ;)
The other way yields a SQL statement with single quotes around the
search term insided the percent signs (e.g. " LIKE %'my search
phrase'% "), which generates a SQL error.
BTW, checking the test cases in the core is very helpful in finding
examples to go by.
On Jun 16, 11:19 am, Mariano Iglesias <[EMAIL PROTECTED]>
wrote:
> Please read the release notes regardingLIKEand other SQL operators.
> That should be:
>
> $conditions= array("or"=>(array(
> 'edificiLIKE%?%' => $searchText,
> 'adrecaLIKE%?%' => $searchText
> )));
>
> On Mon, 2008-06-16 at 03:07 -0700, leo wrote:
> > Call me a misery, but I seem to be having more problems with RC1 than
> > I had with Beta.
>
> > The following works as expected in Beta but invariably returns an
> > empty set in RC1:
>
> > $conditions= array("or"=>(array('edifici' => 'LIKE%'.
> > $searchText.'%', 'adreca' => 'LIKE%'.$searchText.'%')));
> > $this->set('immobles', $this->paginate('Immoble',$conditions));
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---