Relative Content

Tag Archive for phperror-handling

Giving a custom response to a MYSQL error

I seem to have a problem that others have reported but the answers provided in other threads do not work in my case. I have code to connect to my db and it works fine, I can use it to connect and insert rows in tables etc. I am testing error handling and that does not work. If I cause an error in the mysqli_connect line, the DIE never executes. Instead I get the ugly PHP error screen “Fatal error: Uncaught mysqli_sql_exception: …“. How do I output my own custom user-friendly error messages instead?

Empty page PHP8.3 instead of error message output

The following code has a problem with the access level of $bla.
Normally I would expect the error output “Fatal error: Access level to mySlave::$bla must be public (as in class myMaster)”. But my page is just empty/white althoug all error reporting is activated.
I have this on two different systems while php-sandbox pages show the error message.