If the format of the databases of both sites is the same , and the products do not have external links for any fields , then you can probably do it easier:
- It is important . Make backups of both sites and their bases
- Highlight products for transfer in the same PHPMyAdmin (manually or select via SELECT and select all selected)
- Click "Export" on the panel at the bottom of the table. The selected records are converted to SQL text of the request, in the end, after the shamanism with the settings, you can get just a set of INSERT for the same database
- Get the resulting SQL text and execute it on the combat database.
- When swearing at PRIMARY KEY from INSERT requests, remove the PRIMARY KEY values from both parts of the INSERT - well, that is, provide the database with the PRIMARY KEY value
- In case of an error or a result that differs from the desired one, return to point 1, recovering the data from the backups made. Consider mistakes and repeat
If files, images, any connections are tied to goods, and so on, then simply mixing or adding in pure SQL will not work. You need to personally approach the task, find out the logic of each field and correctly transfer them. Better a script connected to two databases at once. We take from the first, analyze, carefully insert into the second
UPD: In case records have connections, you need to remove the entire record, along with all connections.
This means that if, for example, record A has three more related records AB, AC, AD in other tables (images, documents, rights, viewing statistics, something else), then it is easier to make a script with approximately the following algorithm:
- Connect to test database
- Take out records of interest to us
- Remove all related records
- Disconnect from the test database, connect to the combat database
- Add all related materials to the appropriate tables (AB, AC, AD from the example above). Get the new value of the field on which the link is built
- In the master record A, change all the fields responsible for the connections to the new values from the associated AB, AC, AD
- Add master record with updated link values
These are complex operations, and in pure SQL it is quite difficult to do them. It is easier to write a script, which is given the identifier of the record in the test database, which must be transferred to the battle database. And transfer them with a script, neatly