Rumah > Artikel > pembangunan bahagian belakang > echo <script>问题
case 'add' : //新增 $sku=$_POST['sku_txt']; $salesku=$_POST['salesku_txt']; $fnsku=$_POST['fnsku_txt']; $diqu=$_POST['diqu_txt']; $asin=$_POST['asin']; $accout=$_POST['account']; $type=$_POST['type']; $query = mysql_query("insert into `sku_rule` (`item_code`,`sku`,`asin`,`fnsku`,`delivery_areas`,`account`,`type`)values('$sku','$salesku','$asin','$fnsku','$diqu','$accout','$type')"); if (mysql_affected_rows($conn) != 1){ echo "<script> alert('添加失败!');location.href='sku_comparison.php';</script>"; } else { echo "<script> alert('添加成功!');location.href='sku_comparison.php';</script>"; } break; case 'del' : //删除 $id=$_GET["delivery"];$SQL = "delete from `sku_rule` where id in($id)"; $result = mysql_query($SQL); if (mysql_affected_rows($conn) != 1){ echo "<script>alert('删除失败!');location.href='sku_comparison.php';</script>"; } else { echo "<script>alert('删除成功!');location.href='sku_comparison.php';</script>"; } break;
用什么浏览器测试的
我觉得是你浏览器的问题,在我的IE9下测试正常
'$sku','$salesku','$asin','$fnsku','$diqu','$accout','$type'
全都加上mysql_real_escape_string();
如:mysql_real_escape_string($sku);
怀疑你的变量里有引号没有转义,导致mysql insert into失败,
IE8,chrome,firefox都是这样的,难道是我电脑的问题???我明天去公司试试