Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6182027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:07:52+00:00 2026-05-24T01:07:52+00:00

I need help on my code igniter app..i can’t seem to find out what’s

  • 0

I need help on my code igniter app..i can’t seem to find out what’s causing the pagination not to work

here’s my controller

$limit = 15;
        $uri_segment = 4;
        $this->load->helper('string');

        $offset = $this->uri->segment( $uri_segment );
        log_message('error',date('Y-m-d H:i:s', time()));
        //load
        //$products = $this->Products_model->get_all();
        $products = $this->Products_model->get_products($limit, $uri_segment);
        //var_dump($products);

        log_message('error', $products );

        //pagination
        $this->load->library('pagination');
        $config['base_url'] = site_url('admin/products/index/');
        $config['total_rows'] = $this->Products_model->count_all();
        $config['per_page'] = $limit;
        $config['uri_segment'] = $uri_segment;
        $this->pagination->initialize($config);

        $data['pagination'] = $this->pagination->create_links();

        //table
        $this->load->library('table');
        $this->table->set_empty(" ");
        $this->table->set_heading('ID', 'Product','Category', 'Actions');
        $i = 0 + $offset;
        foreach ($products as $product){
            ++$i;
            $this->table->add_row($product->id, $product->title, $this->Categories_model->get_by_id($product->category_id)->title,
                anchor('/admin/products/update/'.$product->id,'update',array('class'=>'update')).' '.
                anchor('/admin/products/delete/'.$product->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this product?')"))
            );
        }
        $data['table'] = $this->table->generate();

        //load template
        $this->products_list();
        $this->products_template();
        $this->template->build('products/productList', $data);

here’s my model

function get_products($num, $offset) {
    return $this->db->get($this->tbl_products, $num, $offset)->result();    
}

it generates the links but then it doesn’t load the next set of records..any corrections on the code above?

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:07:54+00:00Added an answer on May 24, 2026 at 1:07 am

    You should give the page to the table, not the full table. Pagination just fills the links, but doesn’t make any change on your data, it’s your responsability.

    Please change:

            $products = $this->Products_model->get_all();
    

    with:

            $products = $this->Products_model->get_page( $Offset, $this->limit ); // It's not clear where do you define limit.
    

    and in your model make the propper selection:

    function get_page( $offset, $limit ){
        return $this->db->get( $this->tbl_products, $limit, $offset )->result();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BeautifulSoup newbe... Need help Here is the code sample... from mechanize import Browser from
i need ur help regarding web services in classic asp here is my code
maybe you can help me out here. I have an issue with my codeigniter
I need help optimizing the code to run faster, unless it is optimized the
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help to use jConfirm with this existing code (php & Jquery &
i need help with disk_total_space function.. i have this on my code <?php $sql=select
Sorry to bother again, but I really need help transforming this Python2 code into
I need some help understanding this bit of code pre { white-space: pre; white-space:
I need syntax help with the following code logic: I have a code block

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.