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

PHP開發(fā)企業(yè)網(wǎng)站教學(xué)刪除新聞資訊

點(diǎn)選刪除跳到delnews.php 檔案

下面我們來看下這個(gè)檔案的程式碼:

<?php
    //刪除新聞資訊部分代碼
    require_once('conn.php');
    $id = $_GET['id'];
    $sql = "delete from news where id='$id'";
    $res = mysql_query($sql);
    if($res){
        echo "<script>alert('刪除成功');location.href='news.php';</script>";
    }else{
        echo "<script>alert('刪除失敗');location.href='news.php';</script>";
    }
?>

連結(jié)資料庫,取得表單帶過來的參數(shù)? id?? 然後寫sql 語句進(jìn)行刪除

執(zhí)行sql 語句刪除成功,跳轉(zhuǎn)展示頁面,這樣我們可以在展示頁面進(jìn)行查看

繼續(xù)學(xué)習(xí)
||
<?php //刪除新聞資訊部分代碼 require_once('conn.php'); $id = $_GET['id']; $sql = "delete from news where id='$id'"; $res = mysql_query($sql); if($res){ echo "<script>alert('刪除成功');location.href='news.php';</script>"; }else{ echo "<script>alert('刪除失敗');location.href='news.php';</script>"; } ?>
提交重置程式碼