<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
</head>
<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>college</th><th>class</th><th>telephone number</th><th>操作</th>
</tr>
<?php
header( 'Content-Type:text/html;charset=utf-8 ');
include_once("conn/conn.php");
$sql="SELECT*from user";
$r=mysqli_query($link,$sql);
// $row=mysqli_fetch_array($r);
while ($row=mysqli_fetch_array($r)) {
?>
<tr>
<td><?php echo $row["id"]?></td>
<td><?php echo $row["name"]?></td>
<td><?php echo $row["password"]?></td>
<td><?php echo $row["sex"]?></td>
<td><?php echo $row["college"]?></td>
<td><?php echo $row["class"]?></td>
<td><?php echo $row["tel"]?></td>
<td><button οnclick="del(<?php echo $row["id"]?>);">删除</button></td>
</tr>
<?php
}
?>
</table>
<script type="text/javascript">
function del($id){
var id=$id;
if(id){
$.get("delete.php",{'id':id,},function(data){
if(data==1){
alert('成功');
window.location.href=window.location.href;
}else{
alert('失败');
}
});
}
}
</script>
</body>
</html>