Archive for December, 2013


Dec

5

2013
premjith

simple search in codeigniter

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); […]

read more