Home  >  Article  >  Backend Development  >  checkboxDelete multiple items

checkboxDelete multiple items

WBOY
WBOYOriginal
2016-07-25 09:10:02942browse
  • {
  • ?>
  • }
  • ?>
  • 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中会调用


  • Statement:
    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