Home > Backend Development > PHP Tutorial > 【PHP MYSQL_QUERY删除不了数据】如题

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

WBOY
Release: 2016-06-23 13:38:08
Original
1702 people have browsed it

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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template