$count = $this->Entry->find('all', array('fields' => array('(max
(Entries.counter)) as max_counter'));

Will return an array with the max_counter value in it.

On Jan 8, 8:29 am, mona <[email protected]> wrote:
> I know how to handle queries but i don't know how to fetch values of
> variables for example
> i wan't to fetch max(counter) so i know how to write query but how to
> store value of this in some variable and print them in my index view
> for eg
>     $query=mysql_query("select max(counter) from entries");
> how to fetch max value from database of some field in cakephp how to
> write this query in cakephp
> $row=mysql_fetch_array($query);
>         $co=$row[0]+1; '
> what to use instead of mysql_fetch_array in cakephp
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to