I have the following connection being made using PDO. Obviously it won't connect as I've not specified host or database (or user or password)
$dbh = new PDO('mysql:host=;dbname=', '', '');
..so how do I catch the exception? I'm trying something like this:
try {
$dbh = new PDO('mysql:host=;dbname=', '', '');
} catch (Exception $e) {
echo 'Error: ', $e->getMessage(), "\n";
}
.. but no message is displayed. Why?