![]() |
If there are rows affected in database, then do this - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: If there are rows affected in database, then do this (/showthread.php?tid=1366) |
If there are rows affected in database, then do this - Taylor - 03-03-2015 I have this delete function in my model. When you press the delete button, it will subtract the number of total notes from the total notes column in my database. For eg. if you had 200 notes, and you deleted one of them, it will be 199 notes AND the note will be deleted from the database. My code: PHP Code: public function entry_delete($pid) { But this doesn't work. I don't know why but when I press the delete button from my view, it will delete it from the database AND subtract -1 from my total_entry table. However, if I comment out the PHP Code: $this->db->delete('dayone_entries'); How do I fix this? Thanks. RE: If there are rows affected in database, then do this - tapan.thapa - 03-03-2015 Hi Taylor, You can try below code. Code: if ($this->db->affected_rows() > 0) |