Recover last error on database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Recover last error on database (/showthread.php?tid=1085) |
Recover last error on database - newphpprogrammer - 02-10-2015 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. RE: Recover last error on database - CroNiX - 02-10-2015 If you turn db_debug on in database.php config file, it will show the errors/messages. RE: Recover last error on database - CroNiX - 02-10-2015 You might also try this: Code: if ($result==true){ RE: Recover last error on database - Narf - 02-11-2015 CI3 has a public error() method that returns both the error number and message. RE: Recover last error on database - newphpprogrammer - 02-11-2015 Thank you Cronix and Narf ! I'm going to implementing the solution mentioned by Cronix. By the way, I'm working with CI2x |