Tuesday, August 30, 2011

Re: Custom query Pagination in cakephp

Hi Sricharan,

You haven't given enough information for us to be able to help you.
Without knowing more about your models, joins, queries, parameters and
data in the database we would be making guesses as to where your
problem lies.

The only thing I can say is it does not look as though you are using
paginate at all, your simply running a custom query. I've been using
Cake for around 3 years now and never yet failed to get what I want
using Cake's built-in pagination (never had to create a custom
paginate - have had to force some joins from time to time) so I highly
reccomend you go back and read about paginate some more.

http://book.cakephp.org/view/1231/Pagination
http://book.cakephp.org/view/1237/Custom-Query-Pagination

HTH, Paul.

On Aug 29, 7:01 am, sricharan <sricharan....@gmail.com> wrote:
> 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: