Mysql and PHP to import client records

Hello Gurus

Just after some advice.

I have made a database for a client and one of their suppliers have said that they like it and want it for their business too. ( Happy days :slight_smile: )

I need to transfer client records from CLient 1 to Client 2’s database. The table structures are identical but obviously the row ID is different.

the structure is
table.client
-client_id
-name
etc

table.project
-pro_id
-pro_client_id – taken from the mysql insert_id() from above
etc etc

My thought was to export 2 text files (from server 2) identified with the unique id (file123_1.txt and file123_2.txt) with the sql info in them as follows

INSERT INTO table.client … get the insertid and run the 2nd one INSERT INTO table.project

FTP them from one server to the other then delete the original files. Then get a php script to include them (on server 1) and run the contents therefore importing them to company 1’s database.

Am I barking up the wrong tree and making things difficult or is there a simpler way that any of you know of.

Thanks in advance

Keith

I would disable auto-increment, import both tables, then setup auto-increment again (starting the seed at the next available number)
http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html