亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP開發(fā) 留言板教程之留言板刪除留言PHP頁面

刪除留言其實(shí)就是刪除我們數(shù)據(jù)庫里的數(shù)據(jù)

我們前面在刪除鏈接之前傳入了每條數(shù)據(jù)的 id 

<td><a href="ressage_delete.php?id=<?php echo $row['id']?>" >刪除</a> </td>

所以在PHP頁面接收id,然后在刪除相關(guān)的id,就可以實(shí)現(xiàn)刪除的功能了

3.jpg

代碼如下

<?php
header("content-type:text/html;charset=utf-8");
$conn=mysqli_connect("localhost","root","root","ressage");
$id=$_GET['id'];
if($conn){
    $sql="delete from ressage_user where id ='$id' ";
    $que=mysqli_query($conn,$sql);
    if($que){
        echo"<script>alert('刪除成功,返回首頁');location.href='ressage.php';</script>";
    }else{
        echo "<script>alert('刪除失敗');location='" . $_SERVER['HTTP_REFERER'] . "'</script>";
        exit;
    }
}die("數(shù)據(jù)庫連接失敗" .mysqli_connect_error());
?>


Weiter lernen
||
<?php header("content-type:text/html;charset=utf-8"); $conn=mysqli_connect("localhost","root","root","ressage"); $id=$_GET['id']; if($conn){ $sql="delete from ressage_user where id ='$id' "; $que=mysqli_query($conn,$sql); if($que){ echo"<script>alert('刪除成功,返回首頁');location.href='ressage.php';</script>"; }else{ echo "<script>alert('刪除失敗');location='" . $_SERVER['HTTP_REFERER'] . "'</script>"; exit; } }die("數(shù)據(jù)庫連接失敗" .mysqli_connect_error()); ?>
einreichenCode zurücksetzen