when I try this code:
$query = '';
foreach ($data as $row)
{
$where = array(
'community_id' => $row->id,
'user_id' => $this->session->user_id,
'status' => 'invited_to_join',
);
$update = array(
'status' => 'joined',
);
$query .= $this->db->set($update)->where($where)->get_compiled_update('community_members').'; ';
}
if ($query)
{
return $this->db->query($query);
}
it gives me the error:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATE
community_members
SETstatus
= 'joined' WHEREcommunity_id
= '18' A' at line 4
this answer uses straightforward query with CASE but I don't know how to convert that into Codeigniter's Query Builder..