Page 1 of 1

mysql update char field error 1064

Posted: Thu Apr 17, 2003 10:27 pm
by redptam
I have the following table, newsblurb, with the following fields:

newsblurb_id int(11) Primary auto_increment
subject varchar(255)
body longtext
postedby varchar(20)
date datetime
show char(1) Y

When I attempt the UPDATE (updating show from Y to N):

UPDATE newsblurb set (subject='testsubject', body='testbody', show='N') where (newsblurb_id='1')

For some reason, I get this error:
ERROR 1064: You have an error in your SQL syntax near 'show='N' where newsblurb_id='1'' at line 1

I have tried and tried and tried. I have searched all over the internet, used sqlcourse.com and searched the mysql documentation, and I can't find what I am doing wrong here.

I greatly appreciate any help I can get. :)

-redptam-

Posted: Fri Apr 18, 2003 5:01 am
by twigletmac
show is a reserved name in MySQL and cannot be used as a column name, so you'll have to change the column's name, maybe to something like 'visible'.

For more info (and always a good thing to check over when you design a table):
http://www.mysql.com/doc/en/Reserved_words.html

Mac

thank you!

Posted: Fri Apr 18, 2003 5:50 pm
by redptam
oh my gosh! I guess I should have thought of that!, thank you so much!