首頁 >後端開發 >php教程 >【PHP MYSQL_QUERY删除不了数据】如题

【PHP MYSQL_QUERY删除不了数据】如题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-23 13:38:081709瀏覽

这是代码
/**
 * 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'");

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn