Answer the question
In order to leave comments, you need to log in
PDO return empty object?
I'm trying to connect to a database.
$pdo = new \PDO("mysql:host=localhost;dbname=database", "user", "password");
Answer the question
In order to leave comments, you need to log in
It seems to me that there is an error in the syntax or you are setting different connection parameters (typo or inattention). It cannot be that mysqli connects with the same parameters, but PDO does not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question