note 98519 added to class.pdo
| From: | Peter at osu1 dot php dot net | Date: | Sun, 20 Jun 2010 18:26:25 +0000 |
| Subject: | note 98519 added to class.pdo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170331@lists.php.net to get a copy of this message | ||
$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
----
Server IP: 217.160.235.204
Probable Submitter: 188.99.184.146
----
Manual Page -- http://www.php.net/manual/en/class.pdo.php
Edit -- https://master.php.net/note/edit/98519
Del: integrated -- https://master.php.net/note/delete/98519/integrated
Del: useless -- https://master.php.net/note/delete/98519/useless
Del: bad code -- https://master.php.net/note/delete/98519/bad+code
Del: spam -- https://master.php.net/note/delete/98519/spam
Del: non-english -- https://master.php.net/note/delete/98519/non-english
Del: in docs -- https://master.php.net/note/delete/98519/in+docs
Del: other reasons-- https://master.php.net/note/delete/98519
Reject -- https://master.php.net/note/reject/98519
Search -- https://master.php.net/manage/user-notes.php