![]() |
affected_rows results to 0 if Active Record update data is the same - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: affected_rows results to 0 if Active Record update data is the same (/showthread.php?tid=32822) |
affected_rows results to 0 if Active Record update data is the same - El Forum - 08-05-2010 [eluser]rvillalon[/eluser] I understand that the affected_rows returns 0 if the data being updated is the same. Is there an alternative to affected_rows to tell me that it still found the row even though it didn't update it because it was the same data? Code: /** affected_rows results to 0 if Active Record update data is the same - El Forum - 08-05-2010 [eluser]rvillalon[/eluser] I just found the following code on codeigniter that might solve my problem: $this->db->set('column', 'value'); $result = $this->db->update('table'); if (!$result) { // there was an error } else if (!$this->db->affected_rows()) { // no error, but nothing changed } else { // record changed } |