Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Multiple MYSQL Database Connection in PHP

Hello Friends,

Do you want to make a MYSQL connection with multiple database in PHP? I am working on project where i need to use two database. I prefer not to make separate MYSQL connection for two database if both database is on same server and accessible by same user. You can simply use the database name before table name. Look at below code.

$sql = "SELECT * FROM db1.tbl, db2.tbl";

Let me know if you find any problem.


No Comments Yet.

Leave a Reply

Your email address will not be published.