codeigniter pagination pulling item more then once codeigniter pagination pulling item more then once codeigniter codeigniter

codeigniter pagination pulling item more then once


var $base_url           = ''; // The page we are linking tovar $prefix             = ''; // A custom prefix added to the path.var $suffix             = ''; // A custom suffix added to the path.var $total_rows         =  0; // Total number of items (database results)var $per_page           = 10; // Max number of items you want shown per pagevar $num_links          =  2; // Number of "digit" links to show before/after the currently viewed pagevar $cur_page           =  0; // The current page being viewedvar $use_page_numbers   = FALSE; // Use page number for segment instead of offsetvar $first_link         = 'First';var $next_link          = '->';var $prev_link          = '<-';var $last_link          = 'Last';var $uri_segment        = 2;var $full_tag_open      = '';var $full_tag_close     = '';var $first_tag_open     = '';var $first_tag_close    = ' ';var $last_tag_open      = ' ';var $last_tag_close     = '';var $first_url          = ''; // Alternative URL for the First Page.var $cur_tag_open       = ' <strong>';var $cur_tag_close      = '</strong>';var $next_tag_open      = ' ';var $next_tag_close     = ' ';var $prev_tag_open      = ' ';var $prev_tag_close     = '';var $num_tag_open       = ' ';var $num_tag_close      = '';var $page_query_string  = FALSE;var $query_string_segment = 'per_page';var $display_pages      = TRUE;var $anchor_class       = '';


Your problem is that you are passing the wrong parameters to your pullMyStories method. On the first page you will be apply the following limit to your query

LIMIT 0,10

Then on the second page

LIMIT 1,10

Then on the third

LIMIT 2,10

So you pagination is only moving forward one item at a time instead of ten. So you need to change this

'query' => $this->data_model->pullMyStories($config['per_page'], $page),

To this

'query' => $this->data_model->pullMyStories($config['per_page'], ($page * $config['per_page'])),


I recently tried so hard to about ci pagination.

I think, your codes right.

What exactly uri string on second page?.. And this listing function is index() ?