Thursday, August 31, 2017

codeigniter query in array

I have tried a few different approaches to this problem with no solutions so far. I am receiving error message:



down voteaccepted
The array you try to pass is a multi dimensional array. Instead try this:
$ids = array();
foreach ($query->result_array() as $id)
    {
        $ids[] = $id['id'];
    }

$this->db->where_in('id', $ids);
codeigniter function Example for where in array query:-
function getMultiCast($religion_id) {
  $this->db->where_in("religion_id", $religion_id);
  $query = $this->db->get("castlist");
  return $query->result();
 }