Mysql - PDO Error - Invalid catalog name: 1046 No database selected
问题 I have a problem with PDO, and I see absolutely no where he come. I can not question my MySQL database. Just to test I used the following code (having quite sour previously configured the parameters for the connection: try { $dbh= new PDO('mysql:host=serverName;dbname=Mydatabase','user','password'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } var_dump($dbh); // gives : object(PDO)#1 (0) { } $res=$dbh->query(