Import simple file into MySQL
I need to import a very simply formatted flat file into a MySQL database. The flat file contains a single entry per line, username. I need to take the username (let's call the variable, $username) and put it into the following two ways:
INSERT INTO usergroup (Username, Groupname) VALUES ('$username', 'static');
INSERT INTO passcheck (Username, Attribute, Value) VALUES ('$username', 'Password', '$username');
The problem is my import file only has the username attribute. All the examples I find want the other data fields included in the file (I don't want them null, I need them defined as above). Is there a way to get a script to read each line, one at a time, then run the above commands to get the username into the database?
I have an AMP server where I can put the data in one record at a time (not good when there are several hundred records to imput). Is there a PHP solution maybe?
Thanks for any help.
|