php实现基本数据增删改操作之删除数据

根据id值删除信息 delete.php

<?php
// header('Content-type:text/html;charset=utf-8');
// $conn = @mysqli_connect('localhost','root','123456','itsource');
 include('./conn.php');
 
$id = $_GET['id'];


// echo $title.$autor.$source.$content;



$sql = "delete from news where id = $id";
$res  = mysqli_query($conn,$sql);
if($res)
{
	echo '<script>alert("删除成功");  location.href="list.php";</script>';
}else {
	echo '删除失败'.mysql_error($conn);
}
echo '<a href="list.php">返回</a>';
?>

发布了62 篇原创文章 · 获赞 102 · 访问量 3137

猜你喜欢

转载自blog.csdn.net/weixin_44763595/article/details/104997232