Page 1 of 1

Syntax error

Posted: Tue Jun 29, 2010 10:35 am
by cardi777
hi everyone

getting a headache, can't work out whats wrong with this syntax! :banghead:

Code: Select all

INSERT INTO import_table ("content_for_import","date_created","date_modified") VALUES ("content here","0000-00-00 00:00:00","0000-00-00 00:00:00") ON duplicate KEY UPDATE "content_for_import"="content here","date_created"="0000-00-00 00:00:00","date_modified"="0000-00-00 00:00:00";

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 ' ("content_for_import","date_created","date_modified") VALUES ("content here","0000-00-00 0' at line 1
the content_for_import is a normal text column with NULL as the default
the date created is a datetime with NULL as the default
the date modified is a datetime with 0000-00-00 00:00:00 as the default
There is an id with auto increment etc, and all other sql works fine manipulating this table

can anyone see what i am doing wrong here, because i just can't see it :P

cheers,
Doug

Re: Syntax error

Posted: Tue Jun 29, 2010 2:41 pm
by Darhazer
Try this one:

Code: Select all

INSERT INTO import_table (`content_for_import`,`date_created`,`date_modified`) VALUES ("content here","0000-00-00 00:00:00","0000-00-00 00:00:00") ON duplicate KEY UPDATE `content_for_import`="content here",`date_created`="0000-00-00 00:00:00",`date_modified`="0000-00-00 00:00:00";

Re: Syntax error

Posted: Tue Jun 29, 2010 6:34 pm
by cardi777
thanks heaps, ill give that a shot!

Re: Syntax error

Posted: Wed Jun 30, 2010 9:59 am
by cardi777
it worked beautifully. thanks so much