php - Cakephp custom query with pagination? -
i developing web application, need custom query.i giving code samples below :
function index() { $this->layout = 'reserved'; $info = $this->auth->user(); $user_id = $info["id"]; $club_info = $this->club->find('first', array('conditions' => array('club.user_id' => $user_id))); if ($club_info) { $club_id = $club_info['club']['id']; $club_name = $club_info['club']['club_name']; $this->set(compact('user_id', 'club_id', 'club_name')); $clubtables =$this->clubtable->query("select *from club_tables clubtable left join categories category on clubtable.category_id=category.id left join deals deal on clubtable.id=deal.club_table_id , clubtable.club_id='".$club_id."' , clubtable.status='approved' order deal.status desc"); $this->set('clubtables', $clubtables); } else { $this->set('clubtables', false); } }
everything working fine not able add pagination.any idea, how can add can pagination?
you should using find() method contain option querys inside cakephp , can how use pagination here http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html
Comments
Post a Comment