CodeIgniter Forums
Database activate records delete - 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: Database activate records delete (/showthread.php?tid=44334)



Database activate records delete - El Forum - 08-11-2011

[eluser]Unknown[/eluser]
Database activate records delete always returns true even if it's not there. I can't figure out why.


Database activate records delete - El Forum - 08-11-2011

[eluser]toopay[/eluser]
Did you try using
Code:
$this->db->affected_rows();



Database activate records delete - El Forum - 08-12-2011

[eluser]Aken[/eluser]
The delete() active record command will only return false if there is an error in the SQL statement. If the statement is valid but does not apply to any rows in your database, it will still process correctly and return true, it just won't delete anything because it didn't match.

As toopay said, use the affected_rows() method to check to see if anything was affected.