问题遇到的现象和发生背景
mysql语句在PHPMYADMIN中能执行更新,放在页面中PHP运行不报错,但是数据库不更新
我把MYSQL语句拿到phpmyadmin中去执行,数据库能更新,
问题相关代码,请勿粘贴截图
<?php
include ('../config/config.php');
$id = $_POST['id'];
$gzff = 1;
if ($_POST['gz'] == 0)
{
echo "<script>alert('工资不能为空!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}else{
$gz = $_POST['gz'];
}
$gzff = 1;
$sql = "UPDATE `plan` SET `gz`='$gz',`gzff`='$gzff',`ffren`='$chaozuo' WHERE 'id' ='$id'";
echo $sql;
if (mysqli_query($conn, $sql)) {
echo "<script>alert('工资发放成功!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
} else {
echo "<script>alert('工资发放失败!');location.href='".$_SERVER["HTTP_REFERER"]."';</script>" ;
}
mysqli_close($conn);
?>