Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Letx是表中t允许 NULL 值的列。
x
t
下面的 PDO 语句应该使用哪个值$value来插入 NULL 值?
$value
$db->prepare("INSERT t SET x=:x")->execute(array(':x'=>$value));
您只需将其插入为null:
null
$db->prepare("INSERT t SET x=:x")->execute(array(':x'=>null));
如果需要,还可以添加PDO::PARAM_NULL的数据类型。