/*delete.php*/ <?php include("connect.php"); //判断传值是否为空 if($_GET[‘ud‘]==‘ ‘) { die(‘未传值!‘); mysql_error(); } $sql="delete from stu where stu_id=".$_GET[‘ud‘]; //删除数据库中的数据 mysql_query($sql); $num=mysql_affected_rows(); //函数获得数据库中“受影响的”数据的个数 //返回是否删除成功 if($num>0) {//如果受影响个数大于0,则必然操作成功 echo "<center>"; echo "<script>alert(‘Congratulation!delete successed!‘)</script><br>"; echo "<a href=‘table.php‘>return</a>"; echo "</center>"; } else { echo "<center>"; echo "<script>alert(‘Sorry!failed to delete!‘)</script><br>"; echo "<a href=‘table.php‘>return</a>"; echo "</center>"; } ?>
时间: 2024-10-27 01:40:22