Sunday, August 28, 2011

Custom query Pagination in cakephp

Hi,

I am using a custom query pagination in cakephp and getting problem
with the model name.

i am using join query to retrieve the data from 5 tables. I am using
the query as :

$lim=@$this->passedArgs['limit'];
if(empty($lim))
{
$lim=20;
}
i am passing the limit from the.ctp page and

$result_wait=$this->Waitingroom->query("My sql query...LIMIT $lim");
$this->set(compact('result_wait', 'lim'));
$num=count($result_wait);

$this->set('waitingrooms', $this->paginate());

Here actually i had to get the count from the join query, but i am
getting the count from the model name 'waitingrooms'.

Actually i had to get the count as 3 records, but it is showing the
count as 24 records..

Please help me to fix this problem. Thanks in Advance

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

No comments: