note 98519 deleted from class.pdo by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jun 2010 18:28:06 +0000 |
| Subject: | note 98519 deleted from class.pdo by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170332@lists.php.net to get a copy of this message | ||
Note Submitter: Peter
----
$dsn = 'mysql:dbname=name;host=localhost';
$user = 'root';
$password = '';
$dbh = new PDO($dsn, $user, $password);
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
// simple way to connect to the database using the PDO Class with error handling