Hi

I would like to count some rows but i can't print results of query
exactly - count(*) AS kl - on the screen.

this is my query, and there is no error
$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'
                                                                )
                ));

Only when i try to print on screen like that:
for($i = 0; $i < count($res); $i++){
        echo $res[$i]['DepartmentBook']['kl'].'
'.$res[$i]['DepartmentBook']['department_id'].'<br>';
}

it's showing me this:

Notice (8): Undefined index:  kl
[APP\views\stats_months\current_graph.ctp, line 13]

What should I type here $res[$i]['DepartmentBook']['?????']

-- 
Dominik Gajewski

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to