Tutorialsplane

Codeigniter get affected rows update example


Codeigniter get affected rows update example : $this->db->affected_rows(); is used to get affected rows in codeigniter.
$data = array(
               'name' => $name,
               'email' => $email,
               'phone' => $phone
            );

$this->db->where('id', $id);
$this->db->update('table_name', $data);
$affected_rows = $this->db->affected_rows();