SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast guz's Avatar
    Join Date
    Dec 2001
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    importing from ms excel into mysql

    i am using phpmyadmin and i am trying to import a file from ms excel. i keep getting this:

    Error
    SQL-query :

    LOAD DATA LOCAL INFILE '/tmp/phpVldW6D' INTO TABLE `fans` FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' (`Invoice`, `Day`)

    MySQL said:


    Unknown column 'Invoice' in 'field list'

    Back

    what the????

    is there an inside track to killing any learning curve??? any one with any experience with tis it would be appreciated.....

  2. #2
    SitePoint Enthusiast lieblick's Avatar
    Join Date
    Jun 2001
    Location
    Tallahassee, FL
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Every few months I have to update a HUGE MySQL database from an excel file.

    What I do is make sure that the columns match up. Because when you're using that Load Data Local Infile command, if there is a variation in the number of fields, you get shanked. (my guess is that this is what's happening to you)

    Also make sure that the first field in your excel spreadsheet lines up with the first field in the DB table.

    Lastly, it looks like you're telling it that the fields are terminiated by ;'s ... I usually export excel spreadsheets as CSV (comma separated) or TSV (tab separated) depending on if there are commas in the information you're inserting.
    Vendor Ratings, Coupons & Specials:
    http://www.outcrier.com
    My Personal Site:
    http://www.epock.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •