Wednesday, December 31, 2008

Re: How to display total no of entries from database

> I guess you mean your main table:
>
> Inefficient method:
>
> In your controller:
>
> $total_num_rows = count($this->Model->find('all'));
>
> More efficient method, also works if you would like to do it on several tables.
>
> $num = $this->query("SELECT COUNT(*) FROM table_a, table_b");

ermm

most efficient method:

$total_num_rows = $this->Model->find('count');

happy new year bakers!

j


--

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: