This is how I did it, using the same as you (array from another db)
$list="(";
foreach($data as $value) {
$list .=" ".$value.",";
}
$list=trim($list,",").")";
if ( strlen($list)<3 ) $list ="(0)";
$condition = array("`account_id` IN ".$list);
Yes its ugly but it works...
I never knew that cake would accept an array for a single value in a
condition before. Where is that documented?
"cake is unfortunatly full of 'trade secrets'" (Alkemann, IRC
#cakephp)
Mike
On Sep 26, 12:09 pm, Charlie van de Kerkhof <[EMAIL PROTECTED]>
wrote:
> @Mike: Yes, that is my workaround now. But I get an array from another
> database and want to pass it to another db source for retrieval.
>
> @Christian: Yes, at the moment I use MySQL, but in the future I have
> to use PostgreSQL. But that shouldn't havs to a problem I understood
> of the DBO in Cake. (?)
>
> thnx you both for helping me so far!
>
> On Sep 26, 12:52 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > That seems like a bug - the array list of params for a field have been
> > supported for quite some time in 1.2.x.x
>
> > What DBO do you use ? MySQL?
>
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
>
> > Of Charlie van de Kerkhof
> > Sent: 26. september 2007 12:36
> > To: Cake PHP
> > Subject: FindAll condition can not be an array?
>
> > Hi,
>
> > (v1.2, latest SVN version)
>
> > I try to pass an array to the findAll function like this:
>
> > $condition = array('id'=>array(2,5,6,9,12,45,78,43,76));
> > $this->Artist->findAll($condition);
>
> > But the Query is written to the database is:
> > SELECT * from Artist WHERE (2) AND (5) AND (6) AND (9) AND (12) AND
> > (45) AND (78) AND (43) AND (76);
>
> > What results in returning every row because everything is true.
>
> > Is this a bug or is this not supported (yet?)?
>
> > Thnx!
> > - Charlie
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---