I think everyone's (mostly beginner of CI users) facing difficulties in pagination using with active record.
In CI's official documents, there is no clear statements explains how to use pagination class object in active record. My problem is; can not define current page and set it to SQL statement. Therefore, when program fetches data from MySQL with pagination, all page navigates first 0 and $config['per_page'];. I mean if I set to per_page=20, all pages link's fetches 0,20 of MySQL rows.
My SQL Statement is:
$this->db->query("SELECT b.*, a.adCampaignTitle FROM ads a, sms b WHERE b.`smsAd_ID`=a.ad_ID LIMIT " . $config['per_page'])->result();
My Pagination Class properties :
$this->load->database();
$config['base_url'] = 'http://localhost/index.php/admin/index/page/';
$config['total_rows'] = $this->db->count_all('sms');
$config['per_page'] = 2;
$this->pagination->initialize($config);
If somebody help me to how-to-initialize and set to current page into SQL part I will be very glad ...