In case of
$res = $this->DepartmentBook->find('all', array(
 
'fields' => array(
 
'count(*) AS kl',
 
'DepartmentBook.department_id'
                                                                ),
 
'conditions' =>      array(
 
'DepartmentBook.extract_date' => null,
                                                                ),
 
'order' => array(
 
'DepartmentBook.department_id'
                                                                ),
 
'group' => array(
 
'DepartmentBook.department_id'
                                                                )
                ));
You'll have your count under $res[$i][0]['kl'] - NOT $res[$i]
['DepartmentBook']['kl']. Result of aggregate function does not belong
to source table and resides under "unknown" index.

All such problems can be solved by simple output of array to look into
its structure.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to