亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php批量刪除數(shù)據(jù)

 更新時(shí)間:2007年01月18日 00:00:00   作者:  
批量刪除文章這個(gè)技術(shù)沒什么高深莫測(cè)的,只是想寫下來與大家分享。(適合初學(xué)者:)
1、首先在文章列表頁面(list.php),將多選筐命名為:“$del_id[]”,值為文章ID號(hào)。
     例如(list.php):
  <form name="del_form" action="del.php" method="post">
  <?php
        $result=mysql_query("select * from news");
        while($rs=mysql_fetch_array($result)){
     ?>
        <input name="del_id[]" type="checkbox" id="del_id[]" value="<?=$rs[id]?>" /><?=$rs[title]?>
     <?php
        }
     ?>
   </form>
2、處理頁面(del.php):
  <?php
     if($del_id!=""){
             $del_num=count($del_id);
             for($i=0;$i<$del_num;$i++){
                 mysql_query("Delete from news where id='$del_id[$i]'");
             } 
             echo("<script type='text/javascript'>alert('刪除成功!');history.back();</script>");
      }else{
             echo("<script type='text/javascript'>alert('請(qǐng)先選擇項(xiàng)目!');history.back();</script>");
      }
    ?>  

相關(guān)文章

最新評(píng)論