IMO findBy magic methods expect a value to be passed, not an SQL expresión.

You are better of using findAll() with SQL expressions.

$results = $this->Customer->findAll(array('address'=>"LIKE
%{$searchTerm}%"));

if ($results !== false && isset($results[0]))
{
        $results = $results[0];
}

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de [EMAIL PROTECTED]
Enviado el: Lunes, 11 de Diciembre de 2006 09:40 p.m.
Para: Cake PHP
Asunto: like clause not working


$results = $this->Customer->findByAddress("LIKE %{$searchTerm}%");

keeps returning false.

However, if I use query() with an appropriate sql statement, I get
results just fine.
Is there something I'm missing?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" 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