Code: Select all
$kategorija = $this->input->post('kategorija');
$this->db->select('*');
$this->db->from('jobs');
if (!empty($kategorija)) {
$cat_array = explode(',', $kategorija);
$count_items = count($cat_array);
if ($count_items == '1') {
$this->db->where("find_in_set($kategorija, po_category)");
} else {
$this->db->group_start();
$count = 0;
foreach ($cat_array as $item) {
$count++;
if ($count == '1') {
$this->db->where_in("find_in_set($item, po_category)");
} else {
$this->db->or_where("find_in_set($item, po_category)");
}
}
$this->db->group_end();
}
}