limit problem in paginate function of cakephp

Discussion in 'PHP' started by pratip, Dec 30, 2009.

  1. #1
    Does anyone knows how to write the following limit syntax within the paginate function of cakephp :

    limit 0,5

    normally what we do is,
    $this->paginate['limit'] = 10;

    but it is not taking like the above format....

    im talking of something like

    $this->Book->find($condition,$fields,$order,"0,5")

    Thanks in advance...
     
    pratip, Dec 30, 2009 IP
  2. kleinnico

    kleinnico Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not sure if I completly understand you, but using limit with the find function works like this:
    $this->Book->find('all',array('limit'=>'10','conditions'=>array('cat_id'=>'3'),'order'=>'id'));
    PHP:
    is
    SELECT * FROM books WHERE cat_id = '3' ORDER BY id LIMIT 10
    Code (markup):
     
    kleinnico, Dec 30, 2009 IP
  3. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
  4. kleinnico

    kleinnico Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    kleinnico, Dec 30, 2009 IP
  5. pratip

    pratip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5

    I want a limit like 0,5 in the paginate function of CakePHP (not find)...

    Plainly speaking, i want this query with the paginate function :
    SELECT * FROM tabs LIMIT 0,5;

    Thanks,
     
    pratip, Dec 30, 2009 IP