在MySQL中将值设置为NULL [英] Set value to NULL in MySQL
本文介绍了在MySQL中将值设置为NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果要以我提交的形式在文本框中未放置任何内容,我希望将值设置为NULL
.我怎样才能做到这一点?
我尝试插入'NULL'
,但这只是将NULL
单词添加到字段中.
I want a value to be set to NULL
if nothing is put into the text box in the form I'm submitting. How can I make this happen?
I've tried inserting 'NULL'
but this just adds the word NULL
into the field.
我不确定应该为此提供什么代码,我只是在编写UPDATE查询.
I'm not sure what code I should provide for this, I'm just writing an UPDATE query.
推荐答案
请勿在更新语句中的引号内放入NULL
.这应该起作用:
Don't put NULL
inside quotes in your update statement. This should work:
UPDATE table SET field = NULL WHERE something = something
这篇关于在MySQL中将值设置为NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文