Reputation: 4945
I hope this is not a dumb question but I really can't find anything on the net as well as anything in the export settings in phpmyadmin.
My question: Is it possible to export data in phpmyadmin based on matching data to column names. For instance if you export a database or table sql statements are written like
INSERT INTO table VALUES ('1','2','3')
What I want to know if it is possible to export the data so the insert statements read
INSERT INTO table (number1,number2,number3) VALUES ('1','2','3')
The idea is that as I am writing a database I want to be able to export at certain times. But since I am constantly adding new fields in the tables I want to be able to import an old export and still be able to match the columns to the data. That way existing fields contain the data and new ones are just left empty.
Is this possible in just php?
Upvotes: 0
Views: 286
Reputation: 1
In "View dump (schema) of table"
Check the "Complete inserts" Option you will get this
INSERT INTO table (number1,number2,number3) VALUES ('1','2','3')
Upvotes: 0
Reputation: 9920
Yes, it it possible. You should use the INSERT format that is similar to update:
INSERT INTO table SET number1 = '1', number2 = '2', number3 = '3';
Phpmyadmin knows how to do this, just search for "Update style inserts"
Upvotes: 1