HTML code
<!doctype html>
<meta charset= "UTF-8" >
<meta name= "Viewport"
Content= "Width=device-width, User-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" >
<meta http-equiv= "x-ua-compatible" content= "Ie=edge" >
<script type= "Text/javascript" src= "Js/jquery.js" ></script>
<title>Document</title>
<style type= "Text/css" >
table.imagetable {
Font-family:verdana,arial,sans-serif;
font-size:11px;
Color: #333333;
border-width:1px;
Border-color: #999999;
Border-collapse:collapse;
}
table.imagetable th {
Background: #b5cfd2 url (' cell-blue.jpg ');
border-width:1px;
padding:8px;
Border-style:solid;
Border-color: #999999;
}
Table.imagetable TD {
Background: #dcddc0 url (' cell-grey.jpg ');
border-width:1px;
padding:8px;
Border-style:solid;
Border-color: #999999;
}
</style>
<body>
<table class= "ImageTable" >
<tr>
<th>id</th>
<th> name </th>
<th> Password </th>
<th> Sex </th>
<th> Department </th>
<th> class </th>
<th> Telephone </th>
<th> Operations </th> <!--add an action column--
</tr>
<?php
Header (' Content-type:text/html;charset=utf-8 ');
Include_once ("conn/conn.php"); Import Database Control page introduced
$sql = "Select*from user"; Querying the user in the database;
$r =mysqli_query ($link, $sql);
$row =mysqli_fetch_array ($R); Types of arrays queried
while ($row =mysqli_fetch_array ($r)) {
/*print_r ($row);
echo "<br>"; * *
/* echo $row ["name"]. " = ". $row [" Mima "]; Query names and passwords can also be queried by keys
echo "<br>"; * *
?>
<tr>
<td><?php echo $row ["id"]?></td>
<td><?php echo $row ["Name"]?></td>
<td><?php echo $row ["Mima"]?></td>
<td><?php echo $row ["Xingbie"]?></td> <!--data from a database loaded with tables--
<td><?php echo $row ["Xibu"]?></td>
<td><?php echo $row ["Banji"]?></td>
<td><?php echo $row ["Tex"]?></td>
<TD style= "color:red;" ><a href= "" onclick= "del (<?php echo $row [" id "]?>);" > Delete </a></td> <!--add a delete onclick implementation in a column jump-
</tr>
<?php
}
?>
<script>
Function del ($id) {
var id= $id;
if (ID) {
$.get ("shanchu.php", {id:id},function (data) {/*get Get data */
if (data=201) {
Alert ("Success");
Window.location.href=window.location.href; /* Refresh */
}else {
Alert ("failure");
}
});
}else {
Alert ("failure");
}
}
</script>
</table>
</body>
PHP Code
<?php
Header (' Content-type:text/html;charset=utf-8 ');
Include_once ("conn/conn.php");
$id =$_get["id"];
$sql = "Delete from USER WHERE id= $id";
$r =mysqli_query ($link, $sql);
if ($r) {
echo "201";
}else{
echo "200";
}
Ajax implementations delete data from a database