why is this happening in codeigniter?

$query1 = $this->db
    ->select('skill_description.description, count(staff_info.staffId) as experienced')
    ->join('staff_info','staff_info.staffId = skill_rating.staffId')
    ->join('skill_description','skill_rating.descriptionId = skill_description.descriptionId')
    ->where ('skill_rating.rating','2')
    ->order_by("skill_description.description asc")

when I use this I get desired result.. but as soon as I add

->where_in ('skill_description.description',$array)

it results a null array which it shouldn't. It should return the same result I think. And if I use the pure sql style for the same query, it works. $array contains all the descriptions. what should I do?

1 answer

  • answered 2018-07-11 06:51 Komal G.

    IF description has string or text datatype then you should go with LIKE.

     $q = $this->db->select('*')
        ->where("(col LIKE '%".$search_string1."%' OR col LIKE '%".$search_string2."%' OR col LIKE '%".$search_string3."%' OR col LIKE '%".$search_string4."%')", NULL, FALSE)