我想變量設置爲NULL
:PHP - 如何添加到變量NULL值並保存到數據庫中?
$q = NULL.",";
$q .= 'abc';
,並保存到數據庫:
mysql_query("INSERT INTO table (col_a, col_b) VALUES (".$q.")")
但是這會產生錯誤消息:
INSERT INTO table (col_a, col_b) VALUES (,'abc')You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ','abc')' at line 2
如何保存NULL
到數據庫中變量?