MYSQLI Data Access Bulk Delete

Source: Internet
Author: User
Tags button type

<link href= ". /bootstrap.min.css "rel=" stylesheet "type=" Text/css "/><script src=". /bootstrap.min.js "></script><script src=". /jquery-1.11.2.min.js "></script>
<body><form action= "./pldelete.php" method= "POST" ><table class= "Table table-striped" > <caption > Personnel Information Display </caption> <thead> <tr> <th><input type= "checkbox" id= "Ckall"/> codename </th&      Gt <th> name </th> <th> gender </th> <th> National </th> <th> birthday </th> <th > Operations </th> </tr> </thead> <tbody> <?php$db = new mysqli ("localhost", "root", "123456", "Cru D "); $sql =" Select Info.code,info.name,sex,nation.name,birthday from Info,nation where Info.nation=nation.code "; $ result = $db->query ($sql), if ($result) {$arr = $result->fetch_all (); foreach ($arr as $v) {$sex = $v [2]? " Male ":" Female ", echo" <tr> <td><input class= ' ck ' type= ' checkbox ' name= ' ck[] ' value= ' {$v [0]} '/>{$v [0]}</t d> <td>{$v [1]}</td> <td>{$sex}</td> <td>{$v [3]}</td> <td> {$v [4]}</td> <td><a href= './delete.php?code={$v [0]} ' onclick=\ ' return confirm (' Confirm delete? ') \ "><button type= ' button ' class= ' btn btn-primary btn-sm ' > Delete </button></a></td> </tr > ";}}? > </tbody></table><div><input type= "Submit" value= "Bulk Delete"/></div></form> <script type= "Text/javascript" >var Ckall = document.getElementById ("Ckall"); Ckall.onclick = function () {var xz = Ckall.checked;var ck = document.getelementsbyclassname ("ck"); for (Var i=0;i<ck.length;i++) {ck[i].checked = XZ;}} </script></body>

Delete Page

<?php$arr = $_post["ck"];//delete from info where code in (' P001 ', ' p002 ', ' p003 ') $str = Implode ("', '", $arr); $sql = "dele Te from info where code in (' {$str} '); $db = new mysqli ("localhost", "root", "123456", "crud"), $result = $db->query ($sql) if ($result) {header ("location:main.php");} Else{echo "Delete failed! ";}

MYSQLI Data Access Bulk Delete

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.