I was assigned to maintain prehistoric PHP application, which uses some 'phpDB' class written by Joe Thong, last updated in 1999. This application connects to two different databases on the same server, taking some data from one and another from the second one.
Now, the limit of mysql_connect
is, that it uses the same connection resource for new connections. Therefore, if I use following code:
$db1 = new phpDB()->connect(/* db1data, database 'one' */);
$db2 = new phpDB()->connect(/* db2data, database 'one' */);
$data = $db1->query($somequery);
EDIT NOTE: new phbDB()->connect
just sets some internal values and does standard mysql_connect
without $new_link
parameter.
Now, the problem is, that the $query
is run over the database two, because it has rewritten previous connection.
This can be solved by using true
as fourth parameter in mysql_connect
. The thing is, I would rather not rewrite something in 12 years old library (because of pure fear of how it will react on live server), and also it works without that fourth parameter on live server. However, me not being server guru, I was unable to locate the proper directive in the server configuration to switch on my local MAMP configuration, to be closer to emulate live enviroment.
Can anyone help me? Thank you.
EDIT: wrapper itself:
phpDB.php – db wrapper – http://scrp.at/wd
phpDB-mysql.php – mysql specific code – http://scrp.at/we