Hi all !
I have been using this snippet below to study exceptions:
<?php
mysqli_report(MYSQLI_REPORT_STRICT);
try {
$connection = new mysqli('localhos', 'root', '', 'test') ;
} catch (Exception $e ) {
echo "Server Error";
}
?>
If, as in the snippet, I misspell the localhost, I am unable to override the php's own message. If, on the other hand I just misspell say the database name with the host spelt correctly, it overrides the php's default message. ( Default messages in both examples above being different).
with the host name misspelt I receive the following warning:
With the host name correct but a wrong database name I get the message defined in the snippet. Namely "Server Error".
Kindly help resolve this.
Thanks very much.