mysql update char field error 1064

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
redptam
Forum Newbie
Posts: 8
Joined: Thu Oct 17, 2002 3:25 pm
Location: Atlanta, GA

mysql update char field error 1064

Post 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-
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
redptam
Forum Newbie
Posts: 8
Joined: Thu Oct 17, 2002 3:25 pm
Location: Atlanta, GA

thank you!

Post by redptam »

oh my gosh! I guess I should have thought of that!, thank you so much!
Post Reply