Home > Backend Development > PHP Tutorial > checkboxDelete multiple items

checkboxDelete multiple items

WBOY
Release: 2016-07-25 09:10:02
Original
956 people have browsed it
  • {
  • ?>
  • }
  • ?>
  • delete.php
  • $link=mysql_connect("localhost","root","");
  • mysql_select_db("dbname");
  • $id=$_POST['select']; //调用input的name
  • foreach($id as $ide){
  • $exec="delete from tablename where sID=$ide";
  • $result=mysql_query($exec);
  • if((mysql_affected_rows()==0) or (mysql_affected_rows==-1))
  • {
  • echo "没有找到记录,或者删除时出错";
  • exit;
  • }
  • else{
  • echo "学生信息已经删除";
  • }
  • }
  • mysql_close();
  • ?>
  • 复制代码
    ID Name
  • //这里的name很重要,到delete.php中会调用


  • Related labels:
    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