Well, the first param for the findAll is the "SQL condition". CakePHP is not smart enough (yet) to understand arrays of conditions, it just accepts a string and place it after the WHERE clause in the SQL statement.
To answer your question, change the array into it's SQL language (i.e. global=1 AND user_id='$id'); HTH -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 08 Desember 2006 22:26 To: Cake PHP Subject: findall custom query Hi there, I have two tables: users: -id -name notes: -id -user_id -public A user can write notes. He can chose, if this note could be seen by the public. Now I want to print out all notes that are flaged as public and are from the user with the id "1". This doesn't work: $id=1; $this->set('notes', $this->Note->findAll(array ('global' => 1, 'user_id' => $id ))); How can I tell findAll give the right result? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
