Skip to content
Advertisement

How to get database name in PDO?

JavaScript

Is there a function or constant within PDO that stores the database name (the testdb value) ? I did a var_dump on $dbh and cant find anything…

Advertisement

Answer

You could use the setAttribute() (essentially a key value pair) method to store the database name when you set it up initially, then use the getAttribute() later in your code to see what the value is.

http://www.php.net/manual/en/pdo.setattribute.php

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement