I
I
infastin2015-06-22 16:14:55
PHP
infastin, 2015-06-22 16:14:55

PDO return empty object?

I'm trying to connect to a database.

$pdo = new \PDO("mysql:host=localhost;dbname=database", "user", "password");

Everything connects fine on the localhost, but if you connect to another database on a different hosting, it returns an empty object.
Moreover, if you try to connect to the database through mysqli, then everything works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CodeInside, 2015-06-22
@CodeInside

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 question

Ask a Question

731 491 924 answers to any question