how to display max and min number in cakephp controller part .
$rs = $this->Item->find('all' , array ('fields' => array('Max(Item.no) as no')));
I want max number of Item table .
I need to add some rand number to that and save it in new row .
Use below query
$rs = $this->Item->find('all' , array ('fields' => array('Max(Item.no) as no')));
This query will return max number in below format
Array
(
[0] => Array
(
[no] => 27
)
)
$max = $rs[0]['no'];