i think this is your answer:
function category($id = null){
if($this->is_user()) {
$this->set('user_obj', $user =
$this->User->findById($this->user['id']));
}
$category = $id;
$cat_id = array_search($category,
Configure::read('Blog.blog_category'));
$this->paginate = array('Blog' => array('conditions' =>
array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => -1));
$blogs = $this->paginate('Blog');
$this->set(compact('blogs', 'category'));
}
On Sun, Nov 18, 2012 at 9:05 PM, Chris <[email protected]> wrote:
> hi guys,... I have a problem with pagination in a controller,... can
> someone help me please,...
> I'm getting an error: SQL Error: 1054: Unknown column 'limit' in 'where
> clause'
>
> how can I do this,...?
>
> function category($id = null)
> {
> if($this->is_user())
> {
> $this->set('user_obj', $user =
> $this->User->findById($this->user['id']));
> }
>
> $category = $id;
>
> $cat_id = array_search($category,
> Configure::read('Blog.blog_category'));
>
> $this->set('category', $category);
>
> $blogs = $this->Blog->find('all', array('conditions' =>
> array('Blog.categories' => $cat_id)));
>
> $this->set('blogs', $blogs, $this->paginate('Blog', array('limit' =>
> 12) ));
>
> thanks in advance,
> chris
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>
--
*Ivan Rimac***
mail: [email protected]
*tel: +385 95 555 99 66*
*http://ivanrimac.com*
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.