It makes a huge difference if the order of fields is different in your text file than it is in your mysql table. For instance, if your mysql table has id before passcode (assuming id is an autoincrement field), then every time you try to load data from this file it grabs the passcode (which is first in the file) and inserts it as an id (which is first in the table). Since the id is an autoincrement column it simply generates an id and ignores the passcode. Since there is only one field per line in your text file there is nothing left to insert into the table's passcode column.
If that is the case then you need to add (passcode) tot he end of your query so that mysql knows that the fields in the text file are to be inserted in the passcode column. mysql will then insert an id and the passcode for each row. Fred Tyler Longren <[EMAIL PROTECTED]> wrote in message 003301c17a94$ac453610$0101a8c0@Longren">news:003301c17a94$ac453610$0101a8c0@Longren... > Hello everyone, > > I posted this message to the mysql mailing list and didn't get a response. > I know a lot of people here are good with SQL. So, here's my e-mail: > > Hello, > > I've been struggling with this all night. Can someone give me a push in the > right direction? I > have a csv file named Sheet1.txt, here's an example of its contents: > "P1002565", > "P1002566", > "P1002638", > > I want to put the contents of Sheet1.txt in a table named 'passcodes'. The > passcodes table has 2 fields: 'id' and 'passcode'. I run this: > LOAD DATA INFILE 'Sheet1.txt' INTO TABLE passcodes FIELDS TERMINATED BY ',' > ENCLOSED BY '"' LINES TERMINATED BY '\n'; > > Nothing gets inserted into the 'passcode' field, but ID's are generated for > every item in Sheet1.txt. > > Can anyone give me some help? Sorry for the sort of off-topic question! > > Thanks, > Tyler Longren > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]