Try

function search()
{
        if (!empty($this->data))
        {
                $search_term = $this->data['Candidato']['nome'];

                $conditions = array(
                        'Candidato.nome' => "LIKE %{$search_term}%"
                );

                $results = $this->Candadato->findAll($conditions);

                $this->set('candidatos', $results);

                $this->render('index');
        }
}

-MI

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

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

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Norman
Enviado el: Lunes, 26 de Febrero de 2007 07:28 p.m.
Para: Cake PHP
Asunto: Ambiguous columns in findAll()

The problem is, when the model have any relation with another table/
model which contains an ambiguous field name, this method fails with
SQL errors: "SQL Error in model Candidato: 1052: Column 'nome' in
where clause is ambiguous".
Is there any way I can avoid this? Recursion = 0 stopped the SQL
errors, but then findAll() returns no results.


--~--~---------~--~----~------------~-------~--~----~
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