21,886
社区成员
发帖
与我相关
我的任务
分享
if ($_POST['action']=="add") {
$typeid=$_POST['typeid'];
$typename=$_POST['typename'];
$rs = mysql_query("select type_id,type_name from product_species where (type_id='$typeid') or (type_name='$typename')") or die("操作失败!");
if( mysql_num_rows($rs) > 0) {
echo"<script>alert('您添加的标识或类别名已经存在,请换一个再试试!');history.go(-1)</script>";
}else {
mysql_query("insert into product_species(type_id,type_name)values('$typeid','$typename')");
if(mysql_affected_rows()) {
echo "<script>alert('类别添加成功!');window.location='admin_product_species.php'</script>";
}else {
echo "<script>alert('类别添加失败!');history.go(-1)</script>" ;
}
}
}