开发者

What is wrong with this MYSQL statment?

开发者 https://www.devze.com 2023-03-17 14:12 出处:网络
开发者_如何学GoFor 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
开发者_如何学Go

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!


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


read is one of MySQL's reserved words.

Try this:

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

精彩评论

暂无评论...
验证码 换一张
取 消