Hi everyone,
I'd like to import a .txt file or even a .csv file into a phpMyAdmin table.
My table in phpma is set up as follows:
I have three fields set up in the table: candidate_id, first_name and last_name.
The canditate_id is set up as follows:
Field: candidate_id, Type: INT, Attributes: unsigned, Null: not null, Extra: auto_increment, Primary key: checked
The first_name and last_name fields each have a VARCHAR type, a length/value of 40, and are set to not null.
The abovementioned information is the only info that was entered - all other possible information for each of the fields mentioned have been left blank, ie. default, collation, etc.
I'd like to enter the data in a Word file then import it, but I don't know how to set the table up in Word so it'll import correctly. I mean should I set up a 3 column table with the columns called author_id, first_name and last_name, then enter the data in the rows? But I'm not sure about this because since the author_id field is an auto-incremented primary key won't this be populated by phpMyAdmin?
Next after I've figured out how to set up the table, I was going to convert the table to text with tabs being the separator. I was then going to save the word file as a .txt file.
After doing a search on this site, I found some instructions on how to import a .csv file into phpma as follows:
click the SQL tab in phpMyAdmin and type the following command:
LOAD DATA INFILE 'C:\myFile.csv'
INTO TABLE mytable
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
Click Go.
The first problem is that this is a .csv file that's imported - can you import a .txt file? Also, my file would be separated with tabs instead of commas so how would I change this part of the code to indicate a tab mark?:
FIELDS TERMINATED BY ','
Would really appreciate any advice on offer.
Thanks