I want to give users the functionality of export data from one WordPress plugin installation from one site to another. A "WordPress plugin" doesn't make the difference, I'm interesting in the recommended approach to export/import data in a PHP application that has the data stored in a MySql database. The data is related to each other in database.
I'm interesting in:
Example:
Student table has: ID, Name and Class_ID...
Class table has: ID, Description...
Example: the execution time, the max files size, the max allowed database queries
Important take in care that destination system could have already data that have the same values in the fields declared as keys, for example:
I export the Class with
ID = 5, and Description = "This is cool class"
and in the destination database could be already the Class with:
ID = 5, and Description = "This is other old class"
Where ID is the primary key in "Class" table.
Any idea around this will be appreciated. If some other information is required let me know.
Thanks in advanced.
I would suggest you write your data into XML. It means you have to construct the XML on export, and then you have to read the XML file on input. This way, you control the format and you can change how you handle the import between versions of your plugin.
I can add a bit more detail on how to do this, if you need, but it looked like you were just looking for information on the general approaches.