<?php
#require_once( inc/dbc1.php );
$dsn = mysql:dbname=dbname;host=somehost;
$user = someuser ;
$password = SomePass ;
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo Connection failed: . $e->getMessage();
}
$pdo1 = new PDO($dsn, $user, $password);
$pdo1->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth1 = $pdo1->prepare( SELECT pID, lname, fname FROM Professor ORDER BY pID DESC LIMIT 5; );
$sth1->execute(array());
?>
错误:
Uncaught exception PDOException with message invalid data source name in PDO->__construct( , NULL, NULL) on line 1
任何人都认为这有什么错误?