Home > php教程 > php手册 > body text

php如何向mysql字段中写入NULL的值?

PHP中文网
Release: 2016-06-13 11:38:09
Original
3118 people have browsed it

php如何向mysql字段中写入NULL的值?

问题:

修改房屋信息时,有一个字段是楼层总数floorall,是int字段,允许空
当修改信息时,如果输入了这个字段的值,则向数据库中写入值,如果没有输入值,则向数据库中写入NULL
怎么实现?

我是这样写的

if($floorall==''){$floorall=NULL;} 
$db->query("updata tabel set floorall ='$floorall'");
Copy after login

回答:

你好,请执行以下语句:

updata tabel set floorall = null
Copy after login

以上就是php如何向mysql字段中写入NULL的值?的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template