php pdo get database name code example Example: php pdo get database name $pdo->query('select database()')->fetchColumn();