awsmketchup
awsmketchup

Reputation: 122

get id of affected row in codeigniter after an update

How do i get the id of the affected row after doing an update in CodeIgniter?

NOTE: $this->db->insert_id() which gets the last insert id returns 0 after an doing an update like so $this->db->update(_table_name).

Doing $this->db->affected_rows() will return x number of affected rows so my question is, is there any way to get the individual id of the affected rows after doing a $this->db->update()?

Upvotes: 1

Views: 7281

Answers (1)

Kamlesh
Kamlesh

Reputation: 664

return $this->db->affected_rows();

if you check record is updated or not then use below code; Other wise you need to return manually id

Upvotes: 2

Related Questions