php编写修改界面,UPDATE语句在网页不能执行是数据库修改,但是echo后的sql语句在mysql中可以正确执行
部分代码如下所示,可以执行insert语句,在list表中添加一条记录,但是goods表格的update命令没有执行,没有报错,可以echo出正确的sql语句。求大神指教...
部分代码如下所示,可以执行insert语句,在list表中添加一条记录,但是goods表格的update命令没有执行,没有报错,可以echo出正确的sql语句。求大神指教问题会处在哪里?!谢谢!
$sql="INSERT INTO `list`(`list_id`,`goods_id`, `goods_name`, `goods_num`, `manager`, `time`, `department_name`, `remark`) VALUES ('','$result6[goods_id]','$_POST[goods_name]','$_POST[goods_num]','$_POST[manager]',now(),'$_POST[department_name]','$_POST[remark]')";
echo $sql;
if ($remark=="借出"||$remark=="使用"){
$result6['goods_reserve']=$result6['goods_reserve']-$goods_num;
$sql10="update `goods` set goods_reserve='$result6[goods_reserve]' where goods_name='".$goods_name."'";
echo $sql10;
}else{
$result6['goods_reserve']=$result6['goods_reserve']+$goods_num;
$sql10="update `goods` set goods_reserve='$result6[goods_reserve]' where goods_name='".$goods_name."'";
echo $sql10;
}
if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
} 展开
$sql="INSERT INTO `list`(`list_id`,`goods_id`, `goods_name`, `goods_num`, `manager`, `time`, `department_name`, `remark`) VALUES ('','$result6[goods_id]','$_POST[goods_name]','$_POST[goods_num]','$_POST[manager]',now(),'$_POST[department_name]','$_POST[remark]')";
echo $sql;
if ($remark=="借出"||$remark=="使用"){
$result6['goods_reserve']=$result6['goods_reserve']-$goods_num;
$sql10="update `goods` set goods_reserve='$result6[goods_reserve]' where goods_name='".$goods_name."'";
echo $sql10;
}else{
$result6['goods_reserve']=$result6['goods_reserve']+$goods_num;
$sql10="update `goods` set goods_reserve='$result6[goods_reserve]' where goods_name='".$goods_name."'";
echo $sql10;
}
if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询