I implent search fields using examples I found here in the group:

function search() {
     if(empty($this->data)) {
          $this->render();
     } else {
          $conditions =array();
          $search_term = $this->data['Candidato']['nome'];
          $conditions['Candidato']['nome'] = "LIKE %{$search_term}%";
          $bullshit = $this->Candidato->findAll($conditions);
          $this->set('candidatos', $bullshit);
          $this->render("index");
    }

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