Day b4 yesterday I was stuck with a simple and frustrating problem. You know that using builtin mysql support in PHP you cannot use concurrently more than one database to work with. That was also my problem while working in such a project where I badly need to read data from one database, validate it against existing data in second database and then insert the data into the second database. So you got the project? Yes its a simple data migration project. But the problem is that I cannot import the old database tables into the new one and I have to work with them keeping seperate.
So you may ask how about reading all the data from first database, then store it in a temporary media and then again read them while inserting in second db. Well that was not possible because in first DB I had 10 tables and in I have to merge all those info in two table in second database. Also I have to validate some of those data against existing data in second DB.
There comes the idea. What I did is a quick-n-dirty solution of this problem. I connected to the first DB using MySQL API, and I connected to the 2nd DB using MySQLi API. That gives me live connection of two DB at the same time. So I read data from first DB using MySQL API and then inserted using MySQLi API.
For sure I could apply another solutions like temporary storage. But why bother when you can trick??? This is just a one time operation, no matter how you do it. All you need is a merged output, at minimum efforts. Ha Ha Ha.