Welcome Guest, Not a member yet? Register   Sign In
CI Pagination function only working for 1st page
#1

[eluser]Unknown[/eluser]
Hi guys, this is my first post so sorry for asking something that's already been asked.

I've tried looking through the other examples and have tried to figure it out on my own but just cant seem to get it.

My code in the controller looks like this :
Code:
function index() {
this->load->library('pagination');
  $this->load->library('table');
  
  $this->table->set_heading('Id', 'The Title', 'The Author','The comments','2','3','4');

$config['base_url'] = 'site/index';
  $config['base_url'] = 'http://127.0.0.1:8888/lyricbites/index';
  $config['total_rows'] = $this->db->get('lyrics')->num_rows();
  $config['per_page'] = 5;
  $config['num_links'] = 3;
  $config['full_tag_open'] = '<div id="pagination">';//this wraps the navigation bits in a div wrapper
  $config['full_tag_close'] = '</div>';
  $this->pagination->initialize($config);
  
  $data['records'] = $this->db->get('lyrics', $config['per_page'], $this->uri->segment(3));

$data['main_content'] = 'options_view';
  $this->load->view('includes/template', $data);

}

The code i'm using in my view to display the thing is the following:
Code:
&lt;?php echo $this->table->generate($records); ?&gt;
&lt;?php echo $this->pagination->create_links(); ?&gt;

The big issue here is that it works for the first page very well. But when I click the second page I either get an apache error
Quote:Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

127.0.0.1
12/10/11 21:31:44
Apache/2.2.17 (Win32) PHP/5.3.6
or
Quote:404 Page Not Found
The page you requested was not found.
in a CI error message if I keep the 'index' in the base_url config.

Any ideas on what i'm doing wrong? Thanks for any help on this.




Theme © iAndrew 2016 - Forum software by © MyBB