[eluser]Wonder Woman[/eluser]
Basically I want to take an input and pass it on to query the database and then bring back the results for the pagination. I want to query a location.
My controller looks like this:
Code:
function index() {
if($this->validation->run()==FALSE){
$this->load->view('property_view', $data);
}
else {
$location = $this->input->post('location');
redirect('property/results');
}
}
function results() {
$data['result']=$this->db->get('properties',10,$this->uri->segment(3));
$config['base_url']=base_url().'/property/results';
$config['total_rows']=$this->db->count_all('properties');
$config['full_tag_open']='<div id="pages">';
$config['full_tag_close']='</div>';
$this->pagination->initialize($config);
$data['links']=$this->pagination->create_links();
$this->load->view('property_results',$data);
}
I figure this needs to be changed to put the query where 'properties' is because that is just requesting the database:
Code:
$data['result']=$this->db->get('properties',10,$this->uri->segment(3));
My model looks like:
Code:
function get_properties($num, $offset) {
$query = $this->db->get('properties', $num, $offset);
return $query;
}
function get_specified_location($location) {
$this->db->like('town', $location);
$query = $this->db->get('properties');
return $query->result_array();
}