PHP环境下如何执行多个sql指令
include("config.php");$yd631_id=$_GET["id"];if($yd631_id!=""){$db=mysql_connect($serv...
include("config.php");
$yd631_id = $_GET["id"];
if($yd631_id!=""){
$db=mysql_connect($servername,$sqlservername,$sqlserverpws) or die("数据库连接失败,请检查!");
mysql_select_db($sqlname,$db);
$sql= "delete from $sqltable where yd631_id='$yd631_id'";
$sql1= "delete frome $sqltable1 where Id='$Id'";
mysql_query($sql);
mysql_query($sql1);
echo("<script type='text/javascript'> alert('删除成功!');location.href='main.php';</script>");
mysql_close();
exit;
}
else{
echo ("<script type='text/javascript'> alert('非法操作!');history.go(-1);</script>");
}
?>
只能执行第一个 展开
$yd631_id = $_GET["id"];
if($yd631_id!=""){
$db=mysql_connect($servername,$sqlservername,$sqlserverpws) or die("数据库连接失败,请检查!");
mysql_select_db($sqlname,$db);
$sql= "delete from $sqltable where yd631_id='$yd631_id'";
$sql1= "delete frome $sqltable1 where Id='$Id'";
mysql_query($sql);
mysql_query($sql1);
echo("<script type='text/javascript'> alert('删除成功!');location.href='main.php';</script>");
mysql_close();
exit;
}
else{
echo ("<script type='text/javascript'> alert('非法操作!');history.go(-1);</script>");
}
?>
只能执行第一个 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询