#1
  1. Webmaster Extraordinaire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Woburn, MA
    Posts
    126
    Rep Power
    15
    I need some serious help and fast. My Web Design company took on a job, that we assumed we knew how to do, only it turns out that I have had some big problems importing data into MySQL. The client has sent me the text files, but I can't get them to go into my database. This is what I am using:

    LOAD DATA INFILE 'new_contacts.txt' REPLACE INTO TABLE GTContac FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '' LINES TERMINATED BY 'n'

    It loads the file fine, but for some reason, the table ends up with only one entry. That entry is basically fine with the exception of the first field, which gets cut off for some reason. ALso, the last field retains its quotation marks for some reason. An example of the entries in the text file can be found below:

    "16103","Bridget","Salantri","Hist Horticulturist","Friends of Washington Crossing Historic Park","215 493 4076","(215)493-4820","fishy@ptd.net","Friends of Washington Crossing Historic Park","PA Hist & Museum Comm, 1112 River Rd","Washington Crossing","PA","18977","USA"

    The listing of what each field is, just in case it might be helpful is below.

    recno - tinyint(6)
    first - varchar(40)
    last - varchar(40)
    title - varchar(40)
    dept - varchar(40)
    combtel - varchar(20)
    combfax - varchar(20)
    combemail - varchar(60)
    ctcmlgorg - varchar(60)
    ctcmlgadd - varchar(60)
    ctcmlgcity - varchar(40)
    ctcmlgst - varchar(15)
    ctcmlgzip - varchar(15)
    ctcmlgctry - varchar(30)


    I would really appreciate any help that anyone could provide. If you need more information let me know. Feel free to email me as well.

    Craig Anderson
    canderson@intrepidwsd.com
  2. #2
  3. Webmaster Extraordinaire
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Woburn, MA
    Posts
    126
    Rep Power
    15
    One more thing that I forgot to add. I have gone through the MySQL reference, etc, but none of that is helping me so far.
  4. #3
  5. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    I can't help you with why the quotes aren't coming off the last field, but the reason the first field is dropped is because you've defined the first field as a TINYINT which can hold the values of -128 thru 127 (or, if declared UNSIGNED, 0 thru 255) and the data you are trying to input is outside of that range.

    The possible reason the quotes aren't dropping may be related to the reason you are only getting one record. The line may be terminated by a carriage return as well as the new line. (/r/n)

Similar Threads

  1. cant insert data into mysql using forms - help please
    By saruman in forum PHP Development
    Replies: 21
    Last Post: May 1st, 2005, 11:42 PM
  2. Replies: 0
    Last Post: August 13th, 2003, 03:18 AM
  3. importing excel data into mysql
    By preemi in forum MySQL Help
    Replies: 3
    Last Post: July 30th, 2002, 03:25 PM
  4. importing data from SQLServer to MySQL
    By mlmsrini in forum MySQL Help
    Replies: 1
    Last Post: July 3rd, 2002, 01:22 PM
  5. MySQL PHP problem
    By The Pie Man in forum PHP Development
    Replies: 6
    Last Post: April 24th, 2001, 05:17 PM

IMN logo majestic logo threadwatch logo seochat tools logo