Click to See Complete Forum and Search --> : Importing a Text file into mysql


luvv2rock
03-27-2007, 02:14 PM
hello, i'm trying to import a | delimited text file into mysql using phpmyadmin's import page. a copy of the text file is at http://www.lewissuperstore.com/vehicles/vehicles.txt if it will help to see what I'm trying to import. my error says "MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRANCHISE_ID|~VIN|~LIST_PRICE|~VEHICLE_YEAR|~MAKE_DESC|~MODEL_DE"

Any help with resolving this would be much appreciated.

luvv2rock
03-27-2007, 04:23 PM
added note my version of mysql is 5.0.22

dustin-weber
04-05-2007, 12:07 AM
Might be a little late on this, but you just need to drill down to a table before you do a text file import (non SQL).

In simple terms:

- Choose a database from the drop down on the left pane.
- Click on the table name you want to import the file to (again on the left).
- Now click the "Import" tab on the right pane.
- On the resulting page, Browse and select your file.
- Now, near the bottom of the page, you'll see a "Format of imported file" section. You want to choose CSV (comma seperated value) and then just set the field delimiters depending on how your text file is set up.

The resulting SQL from the import is helpful when parsing your text file in PHP.

Hope that helps!

Dustin Weber
http://www.dustinweber.com