Welcome Guest, Not a member yet? Register   Sign In
Difference between db->insert and db->insert_string
#2

[eluser]CroNiX[/eluser]
insert() performs the query and insert_string() only returns the SQL as a string, but doesn't perform the actual query.

For # 3, you wouldn't want to do that. insert() returns TRUE/FALSE depending on if there was an error executing the insert.

This would be safer:
Code:
if ($this->db->insert($table, $data))
{
  //no error on insert, return insert id
  return $this->db->insert_id();
}
return FALSE; //insert was unsuccessful so there is no insert_id to send



Messages In This Thread
Difference between db->insert and db->insert_string - by El Forum - 06-30-2014, 04:39 AM
Difference between db->insert and db->insert_string - by El Forum - 06-30-2014, 10:36 AM
Difference between db->insert and db->insert_string - by El Forum - 06-30-2014, 12:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB