(...)add new fields to an existing database-table without loosing the data within that table
This make me think that he does not want want to simply append a table column, but also fill that column with values.
So, if one wants to automate this, a solution is an SQL query like this:
To create the new colum, the SQL request is:
ALTER TABLE table_name ADD new_column_name datatype
(phpMyAdmin offers simpler way to create new table column)
To edit the records in the new column:
UPDATE table_name SET new_column_name = new_value WHERE identifier_column_name=identifier_value;
Example:
UPDATE forum_users SET Firstname="Jason" WHERE UserId="OpenGeek"
UPDATE forum_users SET Firstname="Julien" WHERE UserId="Jul"
(a.s.o)
Not tested, but should be something like that...
With a code editor allowing column mode, you only type once the text that is common to all rows.
So, if you have a csv file with the unique key in one column and the value to insert in another colum, it’s ultra-easy to create the whole set of SQL requests with a code editor allowing column mode and using the SQL tab of phpMyAdmin. Then, you don’t have to write a single line of PHP code.
It’s also much easier than editing each table row manually in phpMyAdmin.