Pergunta

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?

Foi útil?

Solução

Is't the way below?

//do something with original db
$conn->query(...);
...
if (...) {
   // do someting with another db
   $another_conn->query(...);
   ...
}
$conn->query(...);
...
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top