Welcome Guest, Not a member yet? Register   Sign In
pagination URI problem

This is my first time using CI, and probably the first time I've written my own PHP from scratch. I'm not a developer.
Using XAMPP, this page will load 20 results perfectly.


When I click on next, it loads the next 20 results.


However, from here onwards, the next/prev link just keeps adding [/supporttest/index/#] to the URL. I've been trying to fix this, for the past few hours and I still don't know what the problem is. Somebody help please.


public function index
$config = array();
$config["base_url"] = "supporttest/index";
$config['total_rows'] = $data['num_results'];
$config['per_page'] = 20;
$config["uri_segment"] = 3;

$this->load->view('test/test', $data);

Only change I did to the route is switch welcome to my supporttest.php file.
$route['default_controller'] = 'supporttest';

This is the base URL I'm using in my config page. I've hidden index.php using .htaccess.
$config['base_url'] = 'http://localhost/ci2/';

I always load the url helper, because most of the time you need it for pagination, routing and stuff.

$config["base_url"] = base_url()."supporttest/index/"; //!!Trailing slash

To explain that answer - base URL should be either a full URL or an absolute URL, not a relative one like you had.

And use site_url() for links, not base_url().

Thanks Aken, your advise worked.

Theme © iAndrew 2016 - Forum software by © MyBB