Codeigniter search with comma-separated values Codeigniter search with comma-separated values codeigniter codeigniter

Codeigniter search with comma-separated values


I've create this and tested it in my environment and it works like a charm:

    $this->db->select('whatever')->from('your_table');    $this->db->group_start();    foreach($selected_values as $value)    {        $this->db->where("find_in_set($value, icon_ids)");    }    $this->db->group_end();    $result = $this->db->get()->result_array();

I tested it again with your values and it works just fine on (1,2,5) it shows (1,4,5)