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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:57:26+00:00 2026-05-24T12:57:26+00:00

i use of codeigniter Why not work $this->pagination->create_links() in my code? Problem 1: I

  • 0

i use of codeigniter

Why not work $this->pagination->create_links() in my code?
Problem 1: I have this error:

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: offset

Filename: admin/accommodation.php

Line Number: 45

Problem 2: After click on $this->pagination->create_links(), change url, but does not change content table.i use of XAMPP

What do i do?

my code:

function show() 
    {       
        // load pagination class
    $this->load->library('pagination');
    $config['base_url'] = base_url().'admin/accommodation/show';
    $config['total_rows'] = $this->db->count_all('hotel_submits');
    $config['per_page'] = '2';

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

    $offset = (int) $offset; // just to make sure nothing funky gets in here
    $data['results'] = $this->db->query("SELECT @rownum:=@rownum+1 rownum, t.* ".
        "FROM (SELECT @rownum:=0) r, hotel_submits t ".
        "ORDER BY id desc LIMIT $offset, 2");

        $this->load->view('admin/accommodation_submit_show', $data);   
    }

With respect

  • 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-24T12:57:26+00:00Added an answer on May 24, 2026 at 12:57 pm

    The variable $offset that you’re using in your query in undefined. You have to pass it in as a method parameter, or use $this->uri->segment(n).

    Have you read my answer on create jquery pagination?

    You have to pass $offset to your method:

    function show($offset = 0) 
    {
        // code goes here
    }
    

    I’ll assume you have an installation of Codeigniter in a folder called “admin”, and your controller’s name is “accommodation”. In that case you have to set $config['base_url'] like this:

    $config['base_url'] = 'accommodation/show';
    

    EDIT:

    If admin is not the folder you’ve installed Codeigniter in, but rather a folder inside your controllers folder which has the accommodation controller in it, then you’ll have to use this:

    $config['base_url'] = 'admin/accommodation/show';
    $config['uri_segment'] = 4;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a little problem using the CodeIgniter route function. I use the
i use a simple PHP framework (like Codeigniter) without ORM. I have a database
should i use Classname() or __construct() as constructor in CodeIgniter? both work, which should
I have got a problem with my codeigniter library. To transform database data into
using CodeIgniter normally one has to specify the controllers in the config/routes.php file. This
I have a PHP web application built with CodeIgniter MVC framework. I wish to
I use the latest code igniter (2.0.3) and php-active 0.0.1. All are working fine
I am building a report for a client using php and codeigniter. This report
I have spent days trying to make this work based on the examples in
I use of codeigniter.see you: example of my code please fill textbox and checked

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.