$this->db->delete() -- does it return anything? - 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: $this->db->delete() -- does it return anything? (/showthread.php?tid=30194) |
$this->db->delete() -- does it return anything? - El Forum - 05-06-2010 [eluser]parham90[/eluser] Hi, I was wondering if $this->db->delete() returns anything. I am writing a model, and I want the model to return false if deletion fails, so I can notify the user. Is it possible to say: Code: if ($this->db->delete('links')) Oh, and also, is it possible to monitor a forum so I can know when a new question is posted (so I can help answer it!)? I see people answer my questions really fast. Thank you all. $this->db->delete() -- does it return anything? - El Forum - 05-06-2010 [eluser]erik.brannstrom[/eluser] As far as I now, delete() only returns false if an error has occurred, which means it has failed. If, however, you would like to return false if no rows were deleted, you can use $this->db->affected_rows(), which will return the number of rows removed from the table. Hope this helps! $this->db->delete() -- does it return anything? - El Forum - 05-06-2010 [eluser]parham90[/eluser] Thanks! Yes, that does help indeed. |