Question

I have a script that for the most part interacts with one mysql database.

However, when a certain function is called, I am now wanting to do an if{} and in the case of true connect to another mysql database and update a table. After this, other queries will be run on the original database.

What's the proper and most efficient way to do this?

Was it helpful?

Solution

Is't the way below?

//do something with original db
$conn->query(...);
...
if (...) {
   // do someting with another db
   $another_conn->query(...);
   ...
}
$conn->query(...);
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top