Export/Import mySQL query with PHP
I'm looking to implement an Export/Import feature in a WordPress Plug-in. The only scenario that I can think of, is exporting the data after querying the database to some format and then re-reading it (for import) and creating a query with that data.
I'm thinking if there is a shortcut for that. What I want basically is a function to get the SQL query of the data I have in the database and then execute it w开发者_JAVA技巧hen importing. This is basically the same function in PHPmyAdmin that exports the database.
Anyone have an idea?
Check out MySQL's SELECT
Syntax, specifically the ... INTO OUTFILE
portion. Couple that with MySQL's LOAD DATA INFILE
Syntax and you might be in business.
精彩评论