[eluser]jairoh_[/eluser]
Code:
public function program_search( [u]$of[/u] ) //this should have an offset variable for the pagination base url //to pass
{
if ($this->input->post('term')){
$this->front->set('title', 'Search Results');
[u] $this->front->set('res' , $this->wc_search->search($this->input->post('term')));[/u]
$this->load->library('pagination');
[u]$config['base_url'] = base_url().'/site/program_search_results/'; [/u]
//must be $config['base_url'] = your base url to the contoller.'/program_search/';
$this->db->where('JobRef',$this->input->post('term'));
$this->db->or_where('WorkType',$this->input->post('term'));
$this->db->or_where('Parish',$this->input->post('term'));
$this->db->or_where('Location',$this->input->post('term'));
$config['total_rows'] = $this->db->count_all_results('wc_program');
[u]$config['per_page'] = 10;[/u] //this is the limit
$config['num_links'] = 20;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
//should be here
[u]$this->front->set('res' , $this->wc_search->search($this->input->post('term'), offset, limit ));[/u]
$this->front->buffer('content', 'site/program_search_results');
$this->front->render();
}
else
{
$this->front->set('title', 'Program Search');
$this->front->buffer('content', 'site/program_search');
$this->front->render();
}
}
Code:
public function search($term, [u]$of, $limit[ul] ) //pass the offset and limit
{
$data = array();
$this->default_select();
$this->db->like('JobRef', $term);
$this->db->or_like('Area', $term);
$this->db->or_like('Parish', $term);
$this->db->or_like('WorkType', $term);
$this->db->or_like('Location', $term);
$this->default_order_by();
//$this->db->limit(15);
$q = $this->db->get('wc_program');
if ($q->num_rows() > 0)
{
foreach ($q->result_array() as $row)
{
$data[] = $row;
}
}
$q->free_result();
return $data;
}
that's pretty much the concept. but i don't know why your query, just try debugging. i don't use active records. i use bindings.
PS: the underlined tag didn't work