I'd intentionally put in the wrong user name or password, and it bombs out as expected. What I don't understand is why the catch block is not catching the error because it's the statements in the try block that's displaying the error. Can someone explain to me why this is the case?
Thanks.
Network Analysis
Last Comment
elepil
8/22/2022 - Mon
Mark Bullock
The database code is not throwing an exception. It is returning an error which you are testing in the if statement.
elepil
ASKER
To Mark Bullock. Thanks for responding.
That's what I suspected, but the PHP page actually reports the error with its typical orange table block. It is common for database-related function to throw exceptions, as that is what I've become accustomed to in Java. If it isn't throwing exceptions on a critical function as an incorrect username and password to the database, when would it throw exceptions?