On May 29, 6:40 pm, propellorcut <[EMAIL PROTECTED]> wrote:
> I'm trying to find the number of records returned based on a certain
> column having the value 11 or 12. I think I'm writing this correctly,
> but cake doesn't like the fact that I have an OR statement based on 1
> column.
>
> this statement:
>
> $outstanding = $this->Movement-
>
> >find('count',array('conditions'=>array('OR'=>array('Movement.status'=>11,'Movement.status'=>12)),'recursive'=>-1));
>
> produces this query:
>
> SELECT COUNT(*) AS `count` FROM `movements` AS `Movement` WHERE
> ((`Movement`.`status` = 12))

Not much of a surprise, you are overwriting your array key.

e.g.
$conditions =
array('OR'=>array('Movement.status'=>11,'Movement.status'=>12));
debug ($conditions);

For info: 
http://groups.google.com/group/cake-php/search?group=cake-php&q=array+constraints+OR&qt_g=Search+this+group

in this case:
find('count',array('conditions'=>array(''Movement.status'=>array(11,
12)),'recursive'=>-1));

hth,

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