-1
我希望使用分页模型,但是当我插入PAGINATE功能,我得到这个错误:cakephp2:使用分页模型
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'paginate' at line 1
我的代码:
<?php
class Post extends AppModel
{
public function get_posts()
{
$this->paginate = array(
'fields' => array('Post.id', 'Post.title', 'Post.created'),
'limit' => 3,
'order' => array(
'Post.created' => 'DESC'
)
);
$posts = $this->paginate('Post');
return $posts;
}
什么是错的我码?