Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
aussie_clint
Forum Commoner
Posts: 41 Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:
Post
by aussie_clint » Sun Feb 04, 2007 8:42 pm
i cant seem to find where i'm going wrong with my syntax
can someone see what iv don
thanks
Code: Select all
LOAD DATA LOCAL INFILE '/home/computer/public_html/cwpriceCSV.csv'
INTO TABLE `newprice list`
FIELDS TERMINATED BY `,`
LINES TERMINATED BY `\n`
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Feb 04, 2007 8:51 pm
What error are you getting?
aussie_clint
Forum Commoner
Posts: 41 Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:
Post
by aussie_clint » Sun Feb 04, 2007 8:55 pm
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 ',`
LINES TERMINATED BY `\n`' at line 3
error 1064
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Feb 04, 2007 9:12 pm
Should the last two strings be single quotes instead of backticks?
aussie_clint
Forum Commoner
Posts: 41 Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:
Post
by aussie_clint » Sun Feb 04, 2007 9:14 pm
i tryed that
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Feb 04, 2007 9:19 pm
Have you considered using
fgetcsv() ?
aussie_clint
Forum Commoner
Posts: 41 Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:
Post
by aussie_clint » Sun Feb 04, 2007 9:44 pm
i have had this working before, iv just stuffed up and not sure what im doing wrong
phpice
Forum Newbie
Posts: 4 Joined: Sun Feb 04, 2007 1:57 pm
Post
by phpice » Mon Feb 05, 2007 9:55 pm
From the original post, it looks like you are using tick marks (`) instead of single quotes (') for the "terminated by" settings.
aussie_clint
Forum Commoner
Posts: 41 Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:
Post
by aussie_clint » Mon Feb 05, 2007 10:27 pm
thanks, i fixed that up but im still gettinmg this error
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 ''newprice list'
FIELDS TERMINATED BY ','
LINES TERMINATED BY
Code: Select all
LOAD DATA LOCAL INFILE '/home/computer/public_html/cwpriceCSV.csv'
INTO TABLE 'newprice list'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Feb 05, 2007 11:00 pm
"newprice list" should be in backticks. Really, it shouldn't have a space in the name either... then it wouldn't require any backticks or quotes.