note 81147 added to language.exceptions
| From: | webmaster at asylum-et dot com | Date: | Fri, 15 Feb 2008 16:26:21 +0000 |
| Subject: | note 81147 added to language.exceptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136179@lists.php.net to get a copy of this message | ||
According to Mo PDO exeptions do not currently extend the base Exception class and will not be
caught by try {...} catc...
I am unsure what version that pertains to but I am running Windows XP SP 2, Apache 2.2.4.0, PHP
5.2.5.5 and it seems to work just fine.
See the code below.
<?php
$user='username here';
$pass='user pass here';
$dbase='database name here';
try {
$dbh = new PDO('mysql:host=localhost;dbname='.$dbase, $user, $pass);
echo 'Connection opened';
} catch (Exception $e) {
die("Error!: " . $e->getMessage() . '<br/>'."\n");
}
?>
Outputs:
Error!: SQLSTATE[28000] [1045] Access denied for user 'username
here'@'localhost' (using password: YES)
Error!: SQLSTATE[28000] [1045] Access denied for user 'username
here'@'localhost' (using password: NO)
Error!: SQLSTATE[42000] [1049] Unknown database 'database name here'
These are exactly the errors I would expect to see so my guess is that in one of the versions
between what Mo had been using and current this issue has been fixed.
----
Server IP: 209.41.74.194
Probable Submitter: 24.91.95.13
----
Manual Page -- http://www.php.net/manual/en/language.exceptions.php
Edit -- https://master.php.net/note/edit/81147
Del: integrated -- https://master.php.net/note/delete/81147/integrated
Del: useless -- https://master.php.net/note/delete/81147/useless
Del: bad code -- https://master.php.net/note/delete/81147/bad+code
Del: spam -- https://master.php.net/note/delete/81147/spam
Del: non-english -- https://master.php.net/note/delete/81147/non-english
Del: in docs -- https://master.php.net/note/delete/81147/in+docs
Del: other reasons-- https://master.php.net/note/delete/81147
Reject -- https://master.php.net/note/reject/81147
Search -- https://master.php.net/manage/user-notes.php