在我的数据库中,我有一些表,一个用于图像路径,一个用于图像宽度,它们的标准值是 NULL,还有一个空值(复选框和下拉框都是 NULL)当我输入新的路径或宽度不会改变,但我的另一个会改变,这是我的代码。
require_once("../Packages/Connection.php");
$text = mysql_real_escape_string($_POST["articleText"]);
$method = $_POST['method'];
$articleId = $_POST['articleId'];
$imagePath = $_POST['imagePath'];
$imageWidth = $_POST['imageWidth'];
if($method == "update")
{
mysql_query("UPDATE Articles SET text='$text' WHERE id='$articleId'") or die(mysql_error());
}
elseif($method == "delete")
{
mysql_query("DELETE FROM Articles WHERE id=".$articleId."");
};
if($_POST["articleGroup"]=="News")
{
mysql_query("INSERT INTO Articles VALUES(NULL,'".$_POST["articleGroup"]."','".time()."','".$text."', NULL, NULL, NULL)") or die(mysql_error());
}
else
{
mysql_query("INSERT INTO Articles VALUES (NULL,'".$_POST["articleGroup"]."','NULL','".$text."','NULL','".$imagePath."','".$imageWidth."')") or die(mysql_error());
}
提前致谢