Welcome Guest, Not a member yet? Register   Sign In
Query Builder's insert method return type
#1

Hey there,

I'm trying to insert some data into a database using the Query Builder's insert method.

According to the documentation, the insert method returns a boolean value.
https://codeigniter.com/user_guide/datab...tml#insert

However, the function seems to return a database result object upon success. The source appears to confirm this: https://github.com/codeigniter4/CodeIgni....php#L2249

PHP Code:
$success $this->db->table('MyTable')
                    ->insert($dataTRUE);

if (
$success !== TRUE) {
  return FALSE;



Is this deviation between the documentation and the actual behavior intentional?
How can I check that the insert statement completed successfully? Can I be sure that the insert statement always returns false on failure?

I appreciate any input Smile
Reply


Messages In This Thread
Query Builder's insert method return type - by Lorenz - 10-13-2020, 08:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB