我有问题功能工作没有当我点击下降所以这里有什么问题 我只有在点击下拉时才需要删除记录,所以请任何帮助 函数中的查询是否正确?
<?php
$sql="SELECT * FROM administrators";
$record=mysql_query($sql);
function drop($id,$email){
$q="DELETE FROM administrators WHERE id='$id' AND email='$email'";
mysql_query($q);
}
?>
<title>Admins Table</title>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
#creating {
font:bold;
font-size:1.6em;
}
</style>
<a href='cadmin.php' id='creating'>Create New Admin</a><br/><br/>
<table width="920" border="1" cellpadding="1" cellspacing="1">
<tr>
<th>Number</th>
<th>First Name</th>
<th>Last Name</th>
<th>Phone Number</th>
<th>Gender</th>
<th>Email</th>
<th>Address</th>
<th>Update</th>
<th>Delete</th>
</tr>
<?php
while($row=mysql_fetch_assoc($record)){
echo'<tr>';
echo'<td>'.$row['id'].'</td>';
echo'<td>'.$row['first_name'].'</td>';
echo'<td>'.$row['last_name'].'</td>';
echo'<td>'.$row['phone'].'</td>';
echo'<td>'.$row['gender'].'</td>';
echo'<td>'.$row['email'].'</td>';
echo'<td>'.$row['address'].'</td>';
echo'<td>'."<a href='' onclick=''>Edit</a>".'</td>';
echo'<td>'."<a href='' onclick='".drop($row['id'],$row['email'])."'> Drop</a>".'</td>';
echo'</tr>';
}
?>
</table>
//code here
答案 0 :(得分:0)
试试这段代码
mntlist