Rumah >pembangunan bahagian belakang >tutorial php >【PHP MYSQL_QUERY删除不了数据】如题
这是代码
/**
* Created by PhpStorm.
* User: mdf
* Date: 2015/3/18
* Time: 13:59
*/
$id=$_REQUEST['id'];
$delreply="Delete from tb_blog_reply where Blog_id=".$id;
$delblog="Delete from tb_blog_information where Blog_id=".$id;
$DelR=mysql_query($delreply);
$DelB=mysql_query($delblog);
echo $delreply;
echo $delblog;
$url="http://localhost/Myhome/Contorl.php";
if($DelR)
{
$DelB=mysql_query($delblog);
if($DelB){
echo "<script>alert('删除成功!')</script>";
echo "<script>"; <br /> echo "window.location.href='$url'"; <br /> echo "</script>";
}
else
{
echo "<script>alert('删除失败1!')</script>";
echo "<script>"; <br /> echo "window.location.href='$url'"; <br /> echo "</script>";
}
}
else
{
echo "<script>alert('删除失败2!')</script>";
echo "<script>"; <br /> echo "window.location.href='$url'"; <br /> echo "</script>";
}
?>
SQL语句打印出来都是能在数据库删除的,可是运行mysql_query却不能删掉,
没有看到连接数据库的代码
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Cound not connect the db!!'.mysql_error());
}
mysql_select_db("the_blog");
mysql_query("set names 'utf8'");