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 3421454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:06:24+00:00 2026-05-18T06:06:24+00:00

So far found plenty of help to get the pagination working for a get(table)

  • 0

So far found plenty of help to get the pagination working for a get(table) command.

What I need is to pick only few of the entries from a couple of linked tables based on a sql where statement.

I guess the query command is the one to use but in this case how do I do the pagination since that command does not take extra parameters such $config['per_page']

Thanks for the help

  • 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-18T06:06:25+00:00Added an answer on May 18, 2026 at 6:06 am

    Without any more info to go on I think that what you’re looking for is something like the following.

    public function pagination_example($account_id)
    {
        $params = $this->uri->ruri_to_assoc(3, array('page'));
    
        $where = array(
            'account_id'    => $account_id,
            'active'        => 1
        );
    
        $limit = array(
            'limit'     => 10,
            'offset'    => (!empty($params['page'])) ? $params['page'] : 0
        );
    
        $this->load->model('pagination_model');
        $data['my_data'] = $this->pagination_model->get_my_data($where, $limit);
    
        foreach($this->uri->segment_array() as $key => $segment)
        {
            if($segment == 'page')
            {
                $segment_id = $key + 1;
            }
        }
    
        if(isset($segment_id))
        {
            $config['uri_segment'] = $segment_id;
        }
        else 
        {
            $config['uri_segment'] = 0;
        }
    
        $config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/controller_name/method_name/whatever_your_other_parameters_are/page/';              
        $config['total_rows'] = $this->pagination_model->get_num_total_rows();// Make a method that will figure out the total number
        $config['per_page']     = '10';
    
        $this->load->library('pagination');
        $this->pagination->initialize($config);
        $data['pagination'] = $this->pagination->create_links();
    
        $this->load->view('pagination_example_view', $data);
    
    }
    
        // pagination_model
    public function get_my_data($where = array(), $limit = array())
    {
        $this->db
            ->select('whatever')
            ->from('wherever')
            ->where($where)
            ->limit($limit['limit'], $limit['offset']);
        $query = $this->db->get();
    
        if($query->num_rows() > 0)
        {
            $data = $query->result_array();
            return $data;
        }
        return FALSE;
    }
    

    This should at least get you on the right track
    If this isn’t what you’re asking I’d happy to help more if you can be a little more specific. How about some of your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the jQuery equivalent of querySelector? The only way I've found so far
hey I want to make a call from my application, so far I found
I'm looking for a getopt library for c#. So far I found a few
I need a way to adjust hue/sat of a Bitmap. So far I found
I have been searching for a solution to this and so far found nothing
I'm trying to capture dvdauthor's output to a file. So far i found this
What I found so far are some online resources like this: http://www.torsten-horn.de/techdocs/java-hibernate.htm (GER) https://www.hibernate.org/5.html
Hello this is may first question and I have found so far the following
This is a common question, but the explanations found so far and observed behaviour
I have been looking for a SSO system. So far I have found CAS.

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.