PHP 结合 Boostrap 结合 js 实现学生列表删除编辑及搜索功能
php  /  管理员 发布于 7年前   211
这个自己的小项目要先告一段落了。可能还有许多bug。请见谅 删除学生功能 PHP: 编辑学生功能(整体上和添加学生功能差不到,稍微有些许变化) HTML:// 这里是通过前端代码HTML中的 url 传过来的,用 $_GET 来获取(相关HTML代码可以看一下到主页看一下前几条博客)if (empty($_GET['num'])) exit('
找不到您要删除的学生的学号
');$num = $_GET['num'];$connection = mysqli_connect('localhost', 'root', '密码', 'students_info_system');if (!$connection) exit('连接数据库失败
');$query = mysqli_query($connection, "delete from students where num = {$num}");if (!$query) exit('该学生信息查询失败
');// 注意:这里传入的是连接对象$affected_rows = mysqli_affected_rows($connection);if ($affected_rows !== 1) exit('删除失败
');header('Location: student_info.php');
编辑学生