Hi,


If the databases are in the same mysql server, then you could qualify
the table select with the database name and simply re-use the
connection

select db_name.table_name.field from db_name.table_name [where]

No offence, but if I saw this in an application's source code, I'd run a mile.

The negligible overhead of simply making two connections is far better in my opinion than having to rewrite each query if the database name changed, or to point an application at a copy of the original database with a different name for testing. At least with the dual-connection approach, you'd only have to change it once.

Of course in a full application, you'd want the two database connection details in a config file, so the databases could even be located on separate servers, and you wouldn't need to make a source code change to point the application to another database.

Regards,
Andy

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to