Recover last error on database |
Hi All,
please, I am trying recover the error message from a trigger in a database that is returned, but must be honest, I don't know how I do!. I have next code: $result=$this->db->insert('vendedor',$datos); if ($result==true){ return true; } else{ echo "Se produjo un error"; } But I need the message from database for show it to the client. I appreciate any help. Best Regards.
If you turn db_debug on in database.php config file, it will show the errors/messages.
You might also try this:
Code: if ($result==true){
CI3 has a public error() method that returns both the error number and message.
Thank you Cronix and Narf !
I'm going to implementing the solution mentioned by Cronix. By the way, I'm working with CI2x |
Welcome Guest, Not a member yet? Register Sign In |