Welcome Guest, Not a member yet? Register   Sign In
$this->db->delete() -- does it return anything?
#1

[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'))
return true;
else
return false;

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.
#2

[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!
#3

[eluser]parham90[/eluser]
Thanks! Yes, that does help indeed.




Theme © iAndrew 2016 - Forum software by © MyBB