table
id,name,status
1 a 3
2 b 3
3 c 3
i have multiple rows in my table.
when i click submit button it check all rows if status of all rows is 4 then i put save condition else it runs another code.
i need to count rows of my table suppose their are 2 rows with status==3 then my forloop count rows and if all the 2 rows being status ==4 then create save logic..
Please help me to implement
below is my code..but it is not working for me..
$cond = array('OrderDetail.order_id'=>trim($this->requestData['orderId']));
$orderData = $this->OrderDetail->find('all',array('conditions'=>$cond));
$numData = sizeof($orderData);
$count=1;
foreach ($orderData as $value) {
if($value['OrderDetail']['status'] > 3 && $value['OrderDetail']['status']!=5){
if($numData == $count) {
// if condition meets and all the rows of table have status==4 then
// save logic here
// }
}
$count= $count+1;
}