[eluser]bcarter[/eluser]
Hi all
I have a bit of a problem which I have come up against. I have recently built a lead tracking application of sorts which was working fine. Anyway I've intergrated into another project and had a go at streamlining it which has gone pretty well except.....
...the pagination. I run a search and it works just right however when I click on the '2' on the pagination links I get a 404 error, page not found.
I have no idea why, can someone help me please?
Here's my controller
Code:
<?php
class Enquiry extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('ion_auth');
$this->load->library('my_functions');
$this->load->library('form_validation');
if (!$this->ion_auth->logged_in())
{
//redirect them to the login page
redirect('auth/login', 'refresh');
}
}
function index()
{
//Load helpers, profiler, models etc
$this->load->model('enquiries/Search_model');
$this->output->enable_profiler(TRUE);
$this->load->library('pagination');
//Load up any data you need
$data['page_title'] = 'Search Lead Database';
//Form Validation
$this->form_validation->set_rules('search', 'Search', 'trim|xss_clean');
//Start to build the page
$this->load->view('includes/head', $data);
$this->load->view('enquiries/includes/header', $data);
//And the rest
if ($this->form_validation->run() == FALSE)
{
$this->load->view('enquiries/search_view', $data);//show errors here
} else {
$data['term'] = $this->input->post('search');
$data['type'] = $this->input->post('type');
$data['interest'] = $this->input->post('interest');
$data['source'] = $this->input->post('source');
$data['referer'] = $this->input->post('referer');
$data['lead_status'] = $this->input->post('status');
$data['total_rows'] = $this->Search_model->num_rows_search_results($data['term'],$data['type'], $data['interest'], $data['source'], $data['referer'], $data['lead_status'] );
$config['base_url'] = base_url() . "index.php/enquiries/enquiry";
$config['total_rows'] = $data['total_rows'];
$config['per_page'] = 10;
$config['num_links'] = 20;
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$data['results'] = $this->Search_model->search_results($data['term'],$data['type'], $data['interest'], $data['source'], $data['referer'], $data['lead_status'], $config['per_page'], $this->uri->segment(3));
$this->load->view('enquiries/search_results_view', $data);
}
$this->load->view('includes/footer');
}
}
Now I'm assuming that because it works in the first instance there's no need to post the views or models here however, if I'm wrong (usually am) then I will post.
Please help me Obi Wan, you're my only hope!