I am developing an web application, for this I need to do custom query.I am giving my 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 AND ClubTable.club_id='".$club_id."' AND ClubTable.status='approved' ORDER BY Deal.status DESC");
$this->set('clubTables', $clubTables);
} else {
$this->set('clubTables', false);
}
}
Everything is working fine but I am not able to add pagination.Any Idea, how can I add can pagination?