且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将NULL作为变量从PHP发送到SQL?

更新时间:2023-01-01 18:58:03

您在正确的轨道上,使"NULL"成为字符串.如果需要将其设置为NULL,则删除$ParentEventID周围的qoutes.

You are on the right track making "NULL" a string. If you need to set it NULL, then remove the qoutes around $ParentEventID.

mysql_query("UPDATE events SET ParentEventID = $ParentEventID");

但是,在执行此操作之前,请确保$ParentEventID === NULL的值.

However, before doing so make sure that the value of $ParentEventID === NULL.