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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:47:47+00:00 2026-05-22T19:47:47+00:00

There is a bit of problem in my code which i am not able

  • 0

There is a bit of problem in my code which i am not able to solve.
I m using CI 1.7.2.
I have implemented the CI Pagination into the system correctly.
The results are displayed fine but the links in the pagination are not rendering correctly.

For eg. If i click on the page 2 then the results are displayed as per the 2nd Page but the current link at pagination numbers remains 1 which should change to 2.

Here is the code that has been implemented

$total = $this->bmodel->countResultsBanner();

    $data['total'] = $total;

    $uri_segment = $this->uri->segment(4);

    if($uri_segment == 0 || empty($uri_segment)){
    $uri_segment = 0;
    }

    $perPage = 5;



    $config['base_url'] = base_url()."index.php/modules/banner/index";

    $config['total_rows'] = $total;

    $config['per_page'] = $perPage;

    $config['num_links'] = 4;

    //$config['cur_tag_open'] = '<b><span class="current_page">';

    //$config['cur_tag_close'] = '</span></b>'; 

    $this->pagination->initialize($config); 

    $result = $this->bmodel->getAllBanners($perPage,$uri_segment);


    $data['result'] = $result;

thanks in advance.

J

  • 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-22T19:47:48+00:00Added an answer on May 22, 2026 at 7:47 pm

    Heyy,

    I also faced the same problem. In the end, solution turned out to be very simple. 🙂

    by default CI assumes that uri segment used for pagination is (3). Which in your case, for you (i am assuming shamelessly) is incorrect.

    $config['base_url'] = base_url()."index.php/modules/banner/index";
    $config['total_rows'] = $total;
    $config['per_page'] = $perPage;
    $config['num_links'] = 4;
    
    $config['uri_segment'] = 3; /* segment of your uri which contains the page number */
    
    $this->pagination->initialize($config);
    

    Hope this solves your problem

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

Sidebar

Related Questions

I have a lot of legacy code which I currently compile using an antiquated
Is there a way to have a 64 bit enum in C++? Whilst refactoring
There's some code in our project that looks a bit like this: Private Sub
I have a feeling my problem is a bit strange, but here goes... I
There is a strange problem occured in my application in which it's showing a
I have a spurious problem which seems to indicate the index value got from
Hmm... Title is a bit of a mouthful, but I'm really not sure which
I have a very simple bit of code that won't work, and have no
I'm having a bit of problem with casting and datagrids. I have a LINQ
Are there any 64-bit version RPMs of MySQL GUI Tools?

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.