How to redirect and save error message on error?
Posted: Fri Apr 20, 2007 3:07 pm
Hi
When an error occures on a page (php- and mysql errors (or any error)), I want to save the error message
to a database.
Right now I have an "or die(mysql_error())" after each mysql_query() call. This displays the error directly to the user.
I'm using this when developing the website (having "display_errors = On" in php.ini).
If I now distribute the website and set "display_errors = Off", then no errors should be displayed to the
user, right?
The thing is, I want all errors to be displayed when developing, but when the website is up and running
public I want to switch off all errors and instead redirect to a 404-page where I save the error message
to a database.
Is this easily done?
Greeting
When an error occures on a page (php- and mysql errors (or any error)), I want to save the error message
to a database.
Right now I have an "or die(mysql_error())" after each mysql_query() call. This displays the error directly to the user.
I'm using this when developing the website (having "display_errors = On" in php.ini).
If I now distribute the website and set "display_errors = Off", then no errors should be displayed to the
user, right?
The thing is, I want all errors to be displayed when developing, but when the website is up and running
public I want to switch off all errors and instead redirect to a 404-page where I save the error message
to a database.
Is this easily done?
Greeting