Write this code in your model and call it from your controller

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function search($limit = 10, $offset = 0){ 
        //fields in data base
        $searchFields = array('title', 'keywords');
        //posted values from the form
	$sector		=	$this->input->post('sector');
	$keyword	=	$this->input->post('keywords');
 
        //loop generating main search query
	foreach ($searchFields as $field) {
		$this->db->or_like($field, $keyword); 					
	}
	$this->db->where('status', 'A');			
	return $this->db->get('jobs', $limit, $offset);
}
Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *

17 − 9 =