Database Error Codes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Database Error Codes (/showthread.php?tid=19689) |
Database Error Codes - El Forum - 06-16-2009 [eluser]blcArmadillo[/eluser] How should I go about getting the error code if a query fails. Right now CI just uses the DB error page to output the error code and such. Is there a way I can get the code so that my program can respond appropriately? I know there are functions such as mysql_errno and mysqli->errno. Should I just use these or is there some built in CI function that would better suited for my needs? Thanks for the help. Database Error Codes - El Forum - 06-16-2009 [eluser]crnalajna[/eluser] You may extend DB_mysql_driver and do what you want with that data. Example, you may send email with that error but not show it to user. /application/libraries/MY_DB_mysql_driver.php Code: class MY_DB_mysql_driver extends CI_DB_mysql_driver { To be able to extend CI_DB class you need to extend Loader class first. http://codeigniter.com/wiki/Extending_Database_Drivers/ |