CodeIgniter Forums
How to use affected_rows in CI4? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to use affected_rows in CI4? (/showthread.php?tid=87215)



How to use affected_rows in CI4? - JohnSonandrbt - 03-27-2023

I am using a custom model that extends the built-in Model in CI4. I want to know how I can perform the function $this->db->affected_rows() after deleting a row. Most examples online demonstrate how to achieve this using a custom model, rather than extending the CI4 model. Any suggestions would be appreciated.


RE: How to use affected_rows in CI4? - InsiteFX - 03-27-2023

PHP Code:
// this
return $this->db->affected_rows();

// or this
echo $this->db->affected_rows();