A. php 紧急求助,想实现点击删除按钮删除数据库内对应的id信息
<?php
if(isset($_GET['id'])&&!empty($_GET['id'])){
$id=intval($_GET['id']);
$sql="delete from jxkc_a1 where id = $id";
if(mysql_query($sql)){
echo "<script type='text/javascript'>alert('操作成功')</script>";
}else{
echo "<script type='text/javascript'>alert('操作失败')</script>";
}
}
?>
<?php
$arr = mysql_query("select * from jxkc_a1 where username='$username' order by id desc" );
while($result = mysql_fetch_array($arr))
{?>
<tr>
<td><span class="STYLE9"> <?php echo $result["lesson"];?> </td>
<td><span class="STYLE9"> <?php echo $result["plantime"];?> </td>
<td><span class="STYLE9"> <?php echo $result["student"];?> </td>
<td><span class="STYLE9"> <?php echo $result["classtime"];?> </td>
<td><span class="STYLE9"> <?php echo $result["type"];?> </td>
<td><a href=(这里假设你的地址是./list.php)"./list.php?id=<?php echo $result["id"] ?>" onclick=".......js">删除</a></td>
</tr><?php } ?>