The value is coming from a form posting. The value is a PHP null in
the form post array so the condition is actually:
$price = $this->Price->find("first", array(
"conditions"=>array(
"Price.product_id"=>$data['OrderDetail']['product_id'],
"Size.name"=>$data['OrderDetail']['price_id'],
"Price.print_mounting_id"=>$data['OrderDetail']
['print_laminating_id']
),
"contain"=>array(
"Size"=>array(
"id", "name"
)
)
));
echo $data['OrderDetail']['print_laminating_id'] == null ? "Yes" :
"No";
Displays 'Yes', so the data in the post array is a PHP null. Oddly,
the following:
$price = $this->Price->find("first", array(
"conditions"=>array(
"Price.product_id"=>$data['OrderDetail']['product_id'],
"Size.name"=>$data['OrderDetail']['price_id'],
"Price.print_mounting_id"=>null
),
"contain"=>array(
"Size"=>array(
"id", "name"
)
)
));
Works as expected and uses IS NULL
WTF?
On May 28, 3:30 pm, Jon Bennett <jmbenn...@gmail.com> wrote:
> > The correct syntax should be:
>
> > WHERE `OrderDetail`.`id` IS NULL
>
> try:
>
> $this->find("first", array(
> "conditions"=>array(
> "OrderDetail.id"=>NULL
> )
> ))));
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment