Currently I connect to database server by this
@$db_connect = mysql_connect('localhost','user','xxx', true);
I have to connect to database server (not specific database name) due to query with multiple database in the same query.
Can anyone suggest me how to do the same thing with PDO?
You will still need to choose one of the databases in the PDO
$dsn, even if you are to be querying across multiple databases. This isn’t really a problem because in your queries you will use the patterndbname.tablename.columnname. When querying against only the database actually specified in the$dsn, you don’t need to use thedbname.You will, of course, need privileges granted on all of the databases you intend to use for the user specified in the connection.