How to Query Multiple Databases in PHP

Posted on Leave a commentPosted in Web Development

You can perform a SQL query against more than one database with PHP. Here is a sample generic SQL query against two databases: SELECT image.image_title, FROM db1.image, db2.greetings WHERE greetings.image_id=image.imageid And here is some PHP sample code on how you would query two databases in a single SQL statement: $query=”INSERT INTO db1.table1 SELECT * […]