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

  • Home
  • SEARCH
  • 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 7401583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:30:40+00:00 2026-05-29T04:30:40+00:00

i am using codeigniter 2.1.0 and mysql database. in my admin panel i have

  • 0

i am using codeigniter 2.1.0 and mysql database. in my admin panel i have a page where i want to show all users with a paginating view. but it is not working. after trying a lot of things
here is my updated code
controller:

function accounts() // controller to view all users
{
    $this -> load -> library('pagination');
    $config['base_url'] = site_url('admin/home/accounts/');
    $config['total_rows'] = $this->db->get('user')->num_rows();
    $config['per_page'] = 2;
    $config['num_links'] = 2;
    $config['full_tag_open'] = '<p id="pagination">';
    $config['full_tag_close'] = '</p>';
    $offset = $this->uri->segment(4,0);
    $this->pagination->initialize($config);
    $this->load->model('admin_model');
    $data['user_data']=$this->admin_model->all_user($config['per_page'],$offset);
    $data['links']=$this -> pagination -> create_links();
    $data['main_content']='admin/accounts';
    $this->load->view('includes/admin/admin_template',$data);
}

view:

<?php foreach ($user_data as $data) {?>
<?php echo 'Name:' . ' ' ?>
<?php echo ($data['name']).'<br/>'; ?>
<?php echo 'E-mail:' . ' ' ?>
<?php echo ($data['email']).'<br/>'; ?>
<br />
<?php } ?>
<?php echo $links;?>

model:

function all_user($per_page,$offset) //shows all uer info
{
    $query = $this->db->get('user', $per_page, $offset);
    $row=$query->result_array();
    return $row;
}

and here is the route:

$route['default_controller'] = "site";
$route['404_override'] = '';
$route['admin']='admin/admin';

i have used the .htaccess mod_rewrite to remove my index.php and the $config[‘url_suffix’]=’.html’ to add a suffix of .html which makes the url look like this
'http://localhost/project/admin/home/accounts.html'
instead of
'http://localhost/project/index.php/admin/home/accounts'
but if i remove the url_suffix in my config.php

*/

$config['url_suffix'] = '';

/*

the pagination works fine. but i want to use url_suffix

*/

$config['url_suffix'] = '.html';

/*

but if i do so, the pagination doesn’t work, and shows 404 page not found error. how do i fix this issue?

  • 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-29T04:30:41+00:00Added an answer on May 29, 2026 at 4:30 am

    I see lots of issues in your code. But 1st thing 1st.

    Put

    $this->uri->segment(4)
    

    in your query in the offset.

    Update: if you haven’t done mod_rewrite, then add ‘index.php’ to your $config['base_url'].

    E.g.
    $config['base_url']=base_url().'index.php/admin/....';

    add your path in above code.

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

Sidebar

Related Questions

I am using codeigniter. My products page shows all the products we have and
I want to insert current time in database using mySQL function NOW() in Codeigniter's
I am using CodeIgniter 2.1.0 and MySQL database. I have uploaded an image through
I'm using CodeIgniter with CodeIgniter sessions that are stored in a MySQL database. I
I'm using CodeIgniter's Active Record class to query the MySQL database. I need to
Using Codeigniter, any numeric data returned from my MySQL database is returned as strings.
I would like to store images in my mySQL database using the CodeIgniter PHP
I am using CodeIgniter 2.1.0 and MySQL. I want to display a horizontal data
How to get records from Excel sheet to Mysql database using Codeigniter php?
Using CodeIgniter's Active Record class and MySQL, I have a table of posts with

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.