![]() |
Number of rows deleted from database (activerecords) - 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: Number of rows deleted from database (activerecords) (/showthread.php?tid=30166) |
Number of rows deleted from database (activerecords) - El Forum - 05-05-2010 [eluser]Unknown[/eluser] Hi, Is it possible to get number of rows delete query affected with activerecords? I've tried num_rows(), but no luck. Throws up an error. The code itself is pretty straightforward; Code: return $this->db Thanks in advance! Number of rows deleted from database (activerecords) - El Forum - 05-05-2010 [eluser]mddd[/eluser] num_rows is to find the number of rows in a select statement. To find the number of affected rows in 'write' type statements, use affected_rows. This is a query you do to the database, not to the query result. So use: Code: $this->db->where($conditions)->delete('mytable'); Number of rows deleted from database (activerecords) - El Forum - 05-05-2010 [eluser]Unknown[/eluser] Ah, yes. Stupid me ![]() Thanks a lot, that indeed did it. |