I'm using CodeIgniter Pagination class to paginate my data 10 rows per page. I'm using foreach loop for that.
My problem is, the loop incrementing operator is reset back to 1 in the second, third & next pagination pages.
Page 1 screenshot [dummy data only]:

Page 2 screenshot [dummy data only]:

Page 3 screenshot [dummy data only]:

My controller:
<?php
class Mypagination extends CI_Controller{
function index(){
$this->load->database();
$this->load->library('pagination');
$config['base_url'] = '/codeigniter/index.php/mypagination/index/';
$config['total_rows'] = $this->db->get('tracking')->num_rows();
$config['per_page'] = 10;
$config['next_link'] = 'Next';
$this->pagination->initialize($config);
$data['query'] = $this->db->get('tracking', $config['per_page'], $this->uri->segment(3));
$this->load->view('mypagination_view', $data);
}
}
My view:
<?php
$i = 1;
foreach($query->result() as $row){
echo $i++ . ') ';
echo $row->name . ' - ' . $row->email;
echo '<br>';
}
echo $this->pagination->create_links();
?>
I want that incrementing operator to continue in the next pagination pages like 11,12,13... in the second page. 21,22,23 in the third page...
How to fix this?
Sorry if this is too basic question. I'm just new with CodeIgniter and PHP.