UPDATE cell to be empty MYSQL PHP

老子叫甜甜 提交于 2019-12-08 00:51:51

问题


Looked around on Google and Stack Overflow, maybe I'm just blind though. Is there a way to UPDATE a table cell with an " " (empty) value. Let's say like:

mysql_query("UPDATE table SET cellname = ' ' WHERE id = '$idneeded'");

Any help much appreciated.


回答1:


you should know that empty string '' is not same as space string ' ' and not same as NULL value.

to update the cell value to empty string :

mysql_query("UPDATE table SET cellname = '' WHERE id = '$idneeded'");



回答2:


UPDATE table SET cellname = ' ' WHERE id = '$idneeded'
                            ^^^---not empty. spaces are not "empty".

Try

cellname=''

or

cellname=NULL

instead.



来源:https://stackoverflow.com/questions/13014836/update-cell-to-be-empty-mysql-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!