Mark
Mark

Reputation: 3859

What is wrong with this MYSQL statment?

For the life of me i've been staring at this for 5 minutes and can't figure out why MYSQL is spitting it back on me

UPDATE noti SET read=(read+1) WHERE id='2068';

Thanks!

Upvotes: 0

Views: 48

Answers (2)

Bohemian
Bohemian

Reputation: 425378

read is one of MySQL's reserved words.

Try this:

UPDATE noti SET `read` = `read` + 1 WHERE id = '2068';

Upvotes: 2

Michael Berkowski
Michael Berkowski

Reputation: 270767

In MySQL, READ is a reserved keyword. You'll need to enclose the column read in backquotes to keep it from being misinterpreted as the READ keyword and correctly interpreted as your column name.

UPDATE noti SET `read`=(`read`+1) WHERE id='2068';

More here: http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

Upvotes: 5

Related Questions