views:

178

answers:

1

I want to export data and structure from MySQL database using PHP. I know about SELECT INTO OUTFILE command but I want to have the file like the one which is generated by PhpMyAdmin in Export window, so all the CREATE TABLE and INSERT INTO.

HDo you know how PhpMyAdmn generates those files? I was browsing through the code and I've found the command SELECT INTO OUTFILE in it. But I'm not sure is this command is used to generate that structure. Is there any other command to do this, or the exported file is created manualy using information about tables schema?

+1  A: 

You can do this using SHOW CREATE TABLE.

candiru
Thank you. I didn't know this command. How about data? Is there any Insert Generator?
Lukasz Lysik
Nothing I know about, but you can easily generate the INSERT statements based on the table structure and the result of the SELECT.
candiru