Welcome Guest, Not a member yet? Register   Sign In
Detecting Model->delete() query result - how to detect error?
#8

(08-21-2020, 08:06 AM)Gary Wrote: Thanks InsiteFX.

I see there is also a brief mention of return results here for regular queries (though not for ->update(), or ->delete() commands, where this thread started): https://codeigniter.com/user_guide/datab...s.html#id2.  The text from the manual is: "When “write” type queries are run it simply returns TRUE or FALSE depending on success or failure."

I've not tested it yet, but I'd be inclined to want to believe a DELETE is a 'write' type query... so in concept, it should return TRUE if it is successful... though, this still leaves the question of when the query executes successfully, but finds nothing to delete (?).

There is you need to scroll down the page.


PHP Code:
insert([$set NULL[, $escape NULL]])

Returns:    
TRUE on successFALSE on failure

---------------------------------------

update([$set NULL[, $where NULL[, $limit NULL]]])

Returns:    
TRUE on successFALSE on failure

---------------------------------------

delete([$where ''[, $limit NULL[, $reset_data TRUE]]])

Returns:    
BaseBuilder instance (method chaining) or FALSE on failure 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Detecting Model->delete() query result - how to detect error? - by InsiteFX - 08-21-2020, 12:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB