0

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?

gio
  • 991
  • 3
  • 12
  • 24

1 Answers1

0

Is't the way below?

//do something with original db
$conn->query(...);
...
if (...) {
   // do someting with another db
   $another_conn->query(...);
   ...
}
$conn->query(...);
...
xdazz
  • 158,678
  • 38
  • 247
  • 274
  • yep, this seems to work: ` if($this == 1){ $db =& MDB2::factory('mysql://host...'); $db->setFetchMode(MDB2_FETCHMODE_ASSOC); $message =& $db->query("UPDATE...."); }` – gio Nov 15 '11 at 03:51