I'm trying to get work some code, and I'm unable to get this connection work.
Code: Select all
try
{
echo $dsn;
$this->dbh = new PDO($dsn, $user, $pass);
echo 'Connected';
} catch (PDOException $e)
{
echo $e->getMessage();
$err[] = 'Databse connection failed: ' . $e->getMessage();
}
mysql:dbname=myDB;host=localhost
and $user and $pass are used for connection.
this linux command works fine:
mysql --user=myUser --pass=myPass myDB
But with this code, there are not echo after PDO connection, neither 'Connected', neither 'error'
What is wrong?
Thanks