How to gracefully degrade SQL errors - 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: How to gracefully degrade SQL errors (/showthread.php?tid=69580) |
How to gracefully degrade SQL errors - colin147 - 12-17-2017 Hi all, If I get an SQL error I'd like to log it and redirect the user to an error page which just informs them there has been an error. The code I have tried below doesn't work (log_message doesn't work, the page isn't redirected and I just get the "Database Error Occurred" page. The error (not the log_message part) is written to my log. Where am I going wrong please? Code: // UPDATE RE: How to gracefully degrade SQL errors - colin147 - 12-17-2017 I found the answer. For those who also encounter this problem, you need to change 'development' to 'production' for the environment at the top of your index.php page. PHP Code: *--------------------------------------------------------------- RE: How to gracefully degrade SQL errors - Narf - 12-20-2017 And/or actually look at your database configuration and see that there's an option for this. |