Error


$dsn = "mysql:host = localhost:dbname = myfirstdb";
 $dbusername = "root";
 $dbpassword = "root";

try {
    $pdo = new pdo($dsn, $dbusername, $dbpassword);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e){
    echo "Connection failed: " . $e->getMessage();
}

Connection failed: SQLSTATE[HY000] [2002] The requested address is not valid in its context




  • 0 Comments
  • 93 Views
  • Share: