问题
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