Switch between multiple database in PDO

I know that I am a couple of months late but you should be able to switch between databases from within your query.

examples:

$sql = "SELECT * FROM dbname.tablename";

$sql = "SELECT * FROM anotherdbname.anothertablename"

So even if your original $pdo object was used ‘blahblah’ as the dbname, you should still be okay based on the select examples I provided.

Leave a Comment