基于PHP的学生管理系统

前言

基于PHP的学生管理系统;

实现 登录、注册、学生信息、修改学生、删除学生、查询学生、添加学生等功能

环境准备

开发平台:PhpStrom2022.1.2 、Phpstudy_pro

数据库:MySQL5.7.26

技术架构

Bootstrap +PHP7.3.4+html5+css3

项目结构

页面展示

1.登录与注册页面

2.首页

3.学生信息

4.修改学生

5.查询学生

6.添加学生

7.管理员信息

8.修改管理员

9.添加管理员

10.查询管理员

11.数据库

注意

1.MySQL 版本5.0以上与8.0以上sql语句有差异,需要调整数据库语句

2.运行项目前提前配置好MySQL数据库

3.本系统实现功能仅供参考


学生信息管理统代码展示

  • 目录

  • 一、登录界面

  • 二、注册页面

  • 三、学生信息

  • 四、添加页面

  • 五、修改页面

  • 六、删除

  • 七、查询页面

  • 八、头部代码

一、登录界面

login.html

login.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        body {
            background: url(images/backgroud.png);
            background-repeat: no-repeat;
            background-size: cover;
            background-attachment: fixed;
        }
        .Login {
            width: 600px;
            height: 350px;
            background: rgb(168, 196, 213);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 0 5px rgba(0,0,0,0.4);
        }
        label {
            display: block;
            margin-left: 10px;
        }
        form {
            margin: 25px 140px;
        }
        h2 {
            margin-top: 35px;
            text-align: center;
            font-size: 25px;
            color: #000000;
        }
        input {
            width: 220px;
            height: 30px;
            background: transparent;
            margin-top: 30px;
            border: none;
            border-bottom: 1px #a77a27 solid;
            outline: none;
            color: #000000;
            font-size: 17px;
            margin-left: 10px;
        }
        input::-webkit-input-placeholder {
            color: #c3cdd0;
        }
        button {
            width: 98px;
            height: 30px;
            border: none;
            margin-top: 55px;
            color: white;
            text-align: center;line-height: 15px;
            background-image: linear-gradient(to right, #7993d4, #ca71fa);
            border-radius: 15px;
            cursor: pointer;
        }
        button:hover {
            box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
        }
        img{
            width: 27px;
            height: 27px;
            position: relative;
            top: 9px;
        }
    </style>
</head>
<body>
<div class="Login">
    <h2 >学生管理系统</h2>
    <form action="login.php" method="post">
        <label>
            <img src="images/user.png">
            <input type="text" name="user" placeholder="请输入用户名" required>
        </label>
        <label>
            <img src="images/password.png">
            <input type="password" name="pwd" placeholder="请输入密码" required>
        </label>
        <button type="submit" value="登录">登录</button>
        <button type="button" id="btn" value="注册">注册</button>
        <button type="button" id="btn0" value="超级管理员">超管登录</button>
    </form>
</div>
<script>
   var b = document.getElementById("btn");
   b.onclick = function () {
       window.location.href="register.html"
   }
    var b0 = document.getElementById("btn0");
    b0.onclick = function () {
        window.location.href="超级管理员/adminlogin.html"
    }
</script>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
header("Content-Type:text/html;charset=utf-8");
session_start();
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$user = $_POST['user'];
$pwd = $_POST['pwd'];
$sql = "SELECT * FROM `admin` WHERE `name` = '{$user}' and `pwd` = '{$pwd}' ";



$stmt= $conn->query($sql);
$result = mysqli_fetch_array($stmt);

if($stmt->num_rows > 0){
    $_SESSION['user'] = $result[0];
    echo "<script>alert(\"登录成功!\")</script>";
    echo "<script>window.location.href='index.php'</script>";

}else{
    echo "<script>alert(\"账号或密码错误,请重新输入!\")</script>";
    echo "<script>window.location.href='login.html'</script>";
}

二、注册页面

register.html

register.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        body {
            background: url(images/backgroud.png) no-repeat;
        }
        .Login {
            width: 600px;
            height: 400px;
            background: rgb(232, 236, 223);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 0 5px rgba(0,0,0,0.4);
        }
        label {
            display: block;
            margin-left: 10px;
        }
        form {
            margin: 25px 140px;
        }
        h2 {
            margin-top: 35px;
            text-align: center;
            font-size: 25px;
            color: #000000;
        }
        input {
            width: 220px;
            height: 30px;
            background: transparent;
            margin-top: 30px;
            border: none;
            border-bottom: 1px #a77a27 solid;
            outline: none;
            color: #000000;
            font-size: 17px;
            margin-left: 10px;
        }
        input::-webkit-input-placeholder {
            color: #c3cdd0;
        }
        button {
            width: 98px;
            height: 30px;
            border: none;
            margin-top: 50px;
            margin-left: 40px;
            color: white;
            text-align: center;
            line-height: 15px;
            background-image: linear-gradient(to right, #7993d4, #ca71fa);
            border-radius: 15px;
            cursor: pointer;
        }
        button:hover {
            box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
        }
        span {
            font-size: 15px;
        }
        #btn > a{
            text-decoration: none;
        }
        img{
            width: 27px;
            height: 27px;
            position: relative;
            top: 9px;
        }
    </style>
</head>
<body>
<div class="Login">
    <h2>管理员注册</h2>
    <form action="register.php" method="post">
        <label>
            <img src="images/user.png">
            <input type="text" class="put" name="user" placeholder="请输入用户名" required>
        </label>
        <label>
            <img src="images/password.png">
            <input type="password" class="put" name="pwd1" placeholder="请输入密码" required>
        </label>
        <label>
            <img src="images/password.png">
            <input type="password" class="put" name="pwd2" placeholder="确认密码" required>
        </label>
        <button type="submit" value="提交">提交</button>
        <button type="button" id="btn" value="返回">返回</button>
    </form>
</div>
<script>
    var b = document.getElementById("btn");
    b.onclick = function () {
        window.location.href="login.html"
    }
</script>
</body>
</html>
<?php
session_start();
header("Content-Type:text/html;charset=utf-8");
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$user = $_POST['user'];
$pwd1 = $_POST['pwd1'];
$pwd2 = $_POST['pwd2'];
$rows = "select `name` from `admin` where `name` = '{$user}'";
$stmt1= $conn->query($rows);
$row = mysqli_num_rows($stmt1);
if ($row == 1){
    echo "<script>alert('此用户已存在,请重新输入!')</script>";
    echo ("<script>window.location.href='register.html'</script>");
}
elseif ($pwd1 == $pwd2){
    $sql = "insert into `admin` (`name`, `pwd`) value ('{$user}','{$pwd1}')";
    $conn->query($sql);
    echo ("<script>alert('注册成功')</script>");
    echo ("<script>window.location.href='login.html'</script>");
}
else{
    echo "<script>alert('密码错误,请重新输入!')</script>";
    echo ("<script>window.location.href='register.html'</script>");
}
$conn->close();

三、学生信息

student.php

<?php
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
?>

<html>
<head>
<title>学生信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--    <link href="css/css1.css" rel="stylesheet">-->
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .btn-warning{
            background-color: #d0455a;
        }
    </style>
</head>
<body>
<?php include("header.php");?>
<div class="container">
    <br>
    <h2 style="text-align: center;color: #3db077">学生信息展示</h2>
    <br>
    <table class="table table-bordered table-hover" style="text-align: center">
        <tr class="info">
            <th>姓名</th>
            <th>学号</th>
            <th>性别</th>
            <th>手机号</th>
            <th>班级</th>
            <th>操作</th>
        </tr>
        <?php
        $sql = "select * from `student` order by `id`";
        $result = mysqli_query($conn,$sql);
        if (mysqli_num_rows($result)>0) {         // 若表中有数据
        $number = mysqli_num_rows($result);     // 取得数据笔数
        if(!isset($_GET['p']))
        {$p=0;}
        else {$p=$_GET['p'];}
        $check = $p + 8;                             // 每页抓取 8 笔数据
        for ($i = 0; $i < $number; $i++) {// 用来呈现多笔数据的循环
        $stu = mysqli_fetch_array($result);

        //选取第 $p 笔到 $check 笔数据
        if ($i >= $p && $i < $check) {
            echo "<tr>";
            echo "<td>{$stu['user']}</td>";
            echo "<td>{$stu['id']}</td>";
            echo "<td>{$stu['gender']}</td>";
            echo "<td>{$stu['phone']}</td>";
            echo "<td>{$stu['class']}</td>";
            echo "<td><a href='delete.php?id={$stu['id']}' class='btn btn-warning'>删除</a>
                      <a href='update3.php?id={$stu['id']}' class='btn btn-warning'>修改</a></td>";
            echo "</tr>";
            $j = $i+1;
            }
        }// for循环
        }
        ?>
    </table>
    <ul class="row pager" style="font-size: 16px;line-height: 30px">
        <li class="col-xs-2 col-xs-push-3">
            <!--- 将 p 值设为 0, 让模块从第一笔数据开始 ---->
            <a href="student.php?p=0">第一页</a>
        </li>
        <li class="col-xs-2 col-xs-push-2" style="margin-left: 20px">
            <?php
            if ($p>7) { // 判断是否有上一页
                $last = (floor($p/8)*8)-8;
                echo "<a href='student.php?p=$last'>上一页</a>";
            }
            else
                echo "<a class='disabled'>上一页</a>";
            ?>
        </li>
        <li class="col-xs-2 col-xs-push-1" style="margin-left: 20px">
            <?php
            if ($i>7 and $number>$check) // 判断是否有下一页
                echo "<a href='student.php?p=$j'>下一页</a>";
            else
                echo "<a class='disabled'>下一页</a>";
            ?>
        </li>
        <li class="col-xs-2" style="margin-left: 30px">
            <?php
            if ($i>7) // 判断目前呈现的笔数之后是否还有页面
            {
                // 取得最后一页的第一笔数据
                $final = floor($number/8)*8;
                echo "<a href='student.php?p=$final'>最后一页</a>";
            }
            else
                echo "<a class='disabled'>最后一页</a>";
            ?>
        </li>
    </ul>
</div>
</body>
</html>

四、添加页面

add.php

add2.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>主页</title>
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css1.css" rel="stylesheet">
</head>
<body>
<?php include("header.php");?>
<div class="container">
    <br>
    <h2 style="text-align: center;color: #3db077">添加学生</h2>
    <br>
<div>
    <form action="add2.php" method="post" class="form-horizontal" role="form">
        <div class="form-group">
            <label for="name" class="control-label col-xs-2">姓名</label>
            <div class="col-xs-8">
                <input id="name" type="text" name="user" class="form-control" placeholder="请输入学生的姓名" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="id" class="control-label col-xs-2">学号</label>
            <div class="col-xs-8">
                <input id="id" type="text" name="id" class="form-control" placeholder="请输入学生的学号" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label class="control-label col-xs-2">性别</label>
            <div class="col-xs-8">
                <label class="radio-inline"><input type="radio" value="男" name="gender" required>男</label>
                <label class="radio-inline"><input type="radio" value="女" name="gender" required>女</label>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="phone" class="control-label col-xs-2">手机号</label>
            <div class="col-xs-8">
                <input id="phone" type="text" name="phone" class="form-control" placeholder="请输入学生的手机号" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="class" class="control-label col-xs-2">班级</label>
            <div class="col-xs-8">
<!--                <input id="class" type="text" name="class" class="form-control" placeholder="请输入学生的班级" required>-->
                <select name="class" class="form-control">
                    <option value="1班">1班</option>
                    <option value="2班">2班</option>
                    <option value="3班">3班</option>
                    <option value="4班">4班</option>
                    <option value="5班">5班</option>
                    <option value="6班">6班</option>
                    <option value="7班">7班</option>
                    <option value="8班">8班</option>
                    <option value="9班">9班</option>
                    <option value="10班">10班</option>
                </select>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-xs-2 col-xs-offset-4">
                <input style="padding: 10px 50px" class="btn btn-success" type="submit" value="提交">
            </div>
            <div class="col-xs-2">
                <input type="reset" style="padding: 10px 50px" class="btn btn-primary" value="重置">
            </div>
        </div>

    </form>
</div>
</div>
</body>
</html>




<?php
session_start();
//中文编码
header("Content-Type:text/html;charset=utf-8");
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$user = $_POST['user'];
$id = $_POST['id'];
$gender = $_POST['gender'];
$phone = $_POST['phone'];
$class = $_POST['class'];

$rows = "select `id` from `student` where `id` = '{$id}'";
$stmt1= $conn->query($rows);
$row = mysqli_num_rows($stmt1);
if ($row == 1){
    echo "<script>alert('此学号已存在,请重新输入!')</script>";
    echo ("<script>window.location.href='add.php'</script>");
}else{
    $sql = "insert into `student` (`user`,`id`,`gender`,`phone`,`class`) value ('{$user}','{$id}','{$gender}','{$phone}','{$class}')";
    $stmt= $conn->query($sql);
    if ($stmt > 0){
        echo ("<script>alert('添加成功')</script>");
        echo ("<script>window.location.href='student.php'</script>");
    }else {
        echo ("<script>alert('添加失败')</script>");
        echo ("<script>window.location.href='student.php'</script>");
    }
}

$conn->close();

五、修改页面

update.php

update2.php

update3.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>主页</title>
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css1.css" rel="stylesheet">
</head>
<body>
<?php include("header.php");?>
<div class="container">
    <br>
    <h2 style="text-align: center;color: #3db077">学生信息修改</h2>
    <br>
<div>
    <form action="update2.php" method="post" class="form-horizontal" role="form">
        <div class="form-group">
            <label for="name" class="control-label col-xs-2">姓名</label>
            <div class="col-xs-8">
                <input id="name" type="text" name="user" class="form-control" placeholder="请输入学生的姓名" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="id" class="control-label col-xs-2">学号</label>
            <div class="col-xs-8">
                <input id="id" type="text" name="id" class="form-control" placeholder="请输入学生的学号" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label class="control-label col-xs-2">性别</label>
            <div class="col-xs-8">
                <label class="radio-inline"><input type="radio" value="男" name="gender" required>男</label>
                <label class="radio-inline"><input type="radio" value="女" name="gender" required>女</label>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="phone" class="control-label col-xs-2">手机号</label>
            <div class="col-xs-8">
                <input id="phone" type="text" name="phone" class="form-control" placeholder="请输入学生的手机号" required>
            </div>
        </div>
        <br>
        <div class="form-group">
            <label for="class" class="control-label col-xs-2">班级</label>
            <div class="col-xs-8">
<!--                <input id="class" type="text" name="class" class="form-control" placeholder="请输入学生的班级" required>-->
                <select name="class" class="form-control">
                    <option value="1">1班</option>
                    <option value="2">2班</option>
                    <option value="3">3班</option>
                    <option value="4">4班</option>
                    <option value="5">5班</option>
                    <option value="6">6班</option>
                    <option value="7">7班</option>
                    <option value="8">8班</option>
                    <option value="9">9班</option>
                    <option value="10">10班</option>
                </select>
            </div>
        </div>
        <br>
        <div class="form-group">
            <div class="col-xs-2 col-xs-offset-4">
                <input style="padding: 10px 50px" class="btn btn-success" type="submit" value="提交">
            </div>
            <div class="col-xs-2">
                <input type="reset" style="padding: 10px 50px" class="btn btn-primary" value="重置">
            </div>
        </div>
    </form>
</div>
</div>
</body>
</html>




<?php
header("Content-Type:text/html;charset=utf-8");
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$user = $_POST['user'];
$id = $_POST['id'];
$gender = $_POST['gender'];
$phone = $_POST['phone'];
$class = $_POST['class'];
$rows = "select `id` from `student` where `id` = '{$id}' and `user` = '{$user}'";
$stmt1= $conn->query($rows);
$row = mysqli_num_rows($stmt1);
if ($row != 1){
    echo "<script>alert('学号不可改变,请重新输入!')</script>";
    echo ("<script>window.location.href='student.php'</script>");
}else{
    $sql = "update `student` set `user` = '{$user}',`gender` = '{$gender}',`phone` = '{$phone}',`class` = '{$class}' where `id` = '{$id}'";
    $stmt= $conn->query($sql);
    if ($stmt > 0){
        echo ("<script>alert('修改成功')</script>");
        echo ("<script>window.location.href='student.php'</script>");
    }else {
        echo ("<script>alert('修改失败')</script>");
        echo ("<script>window.location.href='student.php'</script>");
    }
}

$conn->close();
<?php
header("Content-Type:text/html;charset=utf-8");
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$sql = "SELECT * FROM student WHERE id =".$_GET['id'];
$stmt = $conn->query($sql);//返回预处理对象
$stu = $stmt->fetch_array(MYSQLI_ASSOC);//返回结果集为数组
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>主页</title>
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css1.css" rel="stylesheet">
</head>
<body>
<?php include("header.php");?>
<div class="container">
    <br>
    <h2 style="text-align: center">学生信息修改</h2>
    <br>
    <div>
        <form action="update2.php" method="post" class="form-horizontal" role="form">
            <div class="form-group">
                <label for="user" class="control-label col-xs-2">姓名</label>
                <div class="col-xs-8">
                    <input id="user" type="text" name="user" class="form-control" value="<?php echo $stu['user']?>" placeholder="请输入学生的姓名" required>
                </div>
            </div>
            <br>
            <div class="form-group">
                <label for="id" class="control-label col-xs-2">学号</label>
                <div class="col-xs-8">
                    <input id="id" type="text" name="id" class="form-control" value="<?php echo $stu['id']?>" placeholder="请输入学生的学号" required>
                </div>
            </div>
            <br>
            <div class="form-group">
                <label class="control-label col-xs-2">性别</label>
                <div class="col-xs-8">
                    <label class="radio-inline"><input type="radio" value="男" name="gender" required>男</label>
                    <label class="radio-inline"><input type="radio" value="女" name="gender" required>女</label>
                </div>
            </div>
            <br>
            <div class="form-group">
                <label for="phone" class="control-label col-xs-2">手机号</label>
                <div class="col-xs-8">
                    <input id="phone" type="text" name="phone" class="form-control" value="<?php echo $stu['phone']?>" placeholder="请输入学生的手机号" required>
                </div>
            </div>
            <br>
            <div class="form-group">
                <label for="class" class="control-label col-xs-2">班级</label>
                <div class="col-xs-8">
<!--                    <input id="class" type="text" name="class" class="form-control" value="--><?php //echo $stu['class']?><!--" placeholder="请输入学生的班级" required>-->
                    <select name="class" class="form-control"  value="<?php echo $stu['class']?>" >
                        <option value="1班">1班</option>
                        <option value="2班">2班</option>
                        <option value="3班">3班</option>
                        <option value="4班">4班</option>
                        <option value="5班">5班</option>
                        <option value="6班">6班</option>
                        <option value="7班">7班</option>
                        <option value="8班">8班</option>
                        <option value="9班">9班</option>
                        <option value="10班">10班</option>
                    </select>
                </div>
            </div>
            <br>
            <div class="form-group">
                <div class="col-xs-2 col-xs-offset-4">
                    <input style="padding: 10px 50px" class="btn btn-success" type="submit" value="提交">
                </div>
                <div class="col-xs-2">
                    <input type="reset" style="padding: 10px 50px" class="btn btn-primary" value="重置">
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>




六、删除

delete.php

<?php
header("Content-Type:text/html;charset=utf-8");
//连接数据库
$conn = new mysqli("localhost", "root", "123456", "php",3316)or die("连接失败");
//设置编码
$conn->query("set names utf8");
$id = $_GET['id'];
echo $id;
$sql = "delete from `student` where `id` = '{$id}'";
$stmt= $conn->query($sql);
if ($stmt > 0){
    echo "<script>alert('删除成功')</script>";
    echo "<script>window.location.href='student.php'</script>";
}else {
    echo ("<script>alert('删除失败')</script>");
    echo ("<script>window.location.href='student.php'</script>");
}
$conn->close();

七、查询页面

select.php

<?php
$conn = new mysqli("localhost", "root", "123456", "php", 3316) or die("连接失败");
?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css1.css" rel="stylesheet">
    <title>主页</title>
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        th {
            text-align: center;
        }

        label {
            font-size: 17px;
        }
    </style>
</head>
<?php include("header.php");?>
<div class="container">
    <br>
    <h2 style="text-align: center;color: #3db077">学生信息查询</h2>
    <br>
    <form method="get" action="#" class="form-horizontal" role="form">
        <div class="form-group">
            <label for="name" class="control-label col-xs-2 col-xs-offset-2">请输入要查询的姓名</label>
            <div class="col-xs-4">
                <input id="name" type="text" name="user" class="form-control" placeholder="请输入姓名">
            </div>
            <input style="padding: 7px 30px;border-radius: 5px;border: none" class="col-xs-1 btn-success" type="submit"
                   name="select" value="查询">
        </div>
    </form>
    <table class="table table-bordered table-hover" style="margin-top: 30px; text-align: center">
        <tr class="info">
            <th>姓名</th>
            <th>学号</th>
            <th>性别</th>
            <th>手机号</th>
            <th>班级</th>
        </tr>
        <?php
        //名字模糊查询
        if (isset($_GET['select'])) {
            $user = $_GET['user'];
            $sql = "select * from student where student.user like '%$user%'";
            $result = $conn->query($sql);
            while ($row = $result->fetch_assoc()) {
                echo "<tr>";
                echo "<td>" . $row['user'] . "</td>";
                echo "<td>" . $row['id'] . "</td>";
                echo "<td>" . $row['gender'] . "</td>";
                echo "<td>" . $row['phone'] . "</td>";
                echo "<td>" . $row['class'] . "</td>";
                echo "</tr>";
            }
        }
        ?>
    </table>
</div>
</body>
</html>

八、头部代码

header.php

<?php
$conn = new mysqli("localhost", "root", "123456", "php", 3316) or die("连接失败");
session_start();
?>

<html>
<head>
    <title>主页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/css1.css" rel="stylesheet">
    <link href="bootstarp/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        button {
            top: 7px;
            right: 15px;
        }

        th {
            text-align: center;
        }

        .container {
            width: 1200px;
        }

        .row {
            line-height: 50px;
        }

        .btn-warning {
            background-color: #d0455a;
        }

        body {
            background-image: url("images/backgroud.png");
            background-repeat: no-repeat;
            background-size: cover;
            background-attachment: fixed;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row" style="background-color: #2e7ad5;color: white">
        <div style="font-size: 20px" class="col-xs-3">学生管理系统</div>
        <a href="index.php"><span class="col-xs-1">首页</span></a>
        <a href="student.php"><span class="col-xs-1">学生信息</span></a>
        <a href="update.php"><span class="col-xs-1">修改学生</span></a>
        <a href="select.php"><span class="col-xs-1">查询学生</span></a>
        <a href="add.php"><span class="col-xs-1">添加学生</span></a>
        <span style="left: 60px" class="col-xs-2 col-xs-offset-1">管理员:<?php echo $_SESSION['user'] ?></span>
        <a href="login.html">
            <button class="col-xs-1 btn btn-danger">退出</button>
        </a>
    </div>
</div>
</body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/386743.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

vue安装使用less,解决与webpack的冲突

第077个 查看专栏目录: VUE ------ element UI 专栏目标 在vue和element UI联合技术栈的操控下&#xff0c;本专栏提供行之有效的源代码示例和信息点介绍&#xff0c;做到灵活运用。 提供vue2的一些基本操作&#xff1a;安装、引用&#xff0c;模板使用&#xff0c;computed&a…

C++-带你深度理解string类的常见接口

1. 为什么学习string类&#xff1f; C语言中&#xff0c;字符串是以\0结尾的一些字符的集合&#xff0c;为了操作方便&#xff0c;C标准库中提供了一些str系列的库函数&#xff0c;但是这些库函数与字符串是分离开的&#xff0c;不太符合OOP的思想&#xff0c;而且底层空间需…

LeetCode周赛——384

1.修改矩阵&#xff08;模拟&#xff09; class Solution { public:vector<vector<int>> modifiedMatrix(vector<vector<int>>& matrix) {int n matrix.size();int m matrix[0].size();vector<int> ans(m);for(int i 0; i < m; i)for(…

如何写好一个简历

如何编写求职简历 论Java程序员求职中简历的重要性 好简历的作用 在求职过程中&#xff0c;一份好的简历是非常重要的&#xff0c;它甚至可以直接决定能否被面试官认可。一份出色或者说是成功的个人简历&#xff0c;最根本的作用是能让看这份简历的人产生一定要见你的强烈愿…

腾讯云4核8G服务器够用吗?来看看支持多少人访问!

腾讯云4核8G服务器支持多少人在线访问&#xff1f;支持25人同时访问。实际上程序效率不同支持人数在线人数不同&#xff0c;公网带宽也是影响4核8G服务器并发数的一大因素&#xff0c;假设公网带宽太小&#xff0c;流量直接卡在入口&#xff0c;4核8G配置的CPU内存也会造成计算…

基于 Python 的大数据的电信反诈骗系统

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…

【c语言】字符串常见函数 下

&#x1f388;个人主页&#xff1a;甜美的江 &#x1f389;欢迎 &#x1f44d;点赞✍评论⭐收藏 &#x1f917;收录专栏&#xff1a;c语言 &#x1f91d;希望本文对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论区提出指正&#xff0c;让我们共同学习、交流进步&a…

文生图提示词:视角选择

构图和视角 --视角选择 Perspective Choices 涵盖从基本的摄影视角到更复杂和专业的视角技巧&#xff0c;展示了在视觉艺术创作中可以采用的多样化视角选择。 Eye Level 眼平线视角 High Angle 高角度 Low Angle 低角度 Birds Eye View 鸟瞰视角 Worms Eye View 虫视视角 Front…

【51单片机】直流电机驱动(PWM)(江科大)

1.直流电机介绍 直流电机是一种将电能转换为机械能的装置。一般的直流电机有两个电极,当电极正接时,电机正转,当电极反接时,电机反转 直流电机主要由永磁体(定子)、线圈(转子)和换向器组成 除直流电机外,常见的电机还有步进电机、舵机、无刷电机、空心杯电机等 2.电机驱动…

使用UMAP降维可视化RAG嵌入

大型语言模型&#xff08;LLMs&#xff09;如 GPT-4 已经展示了出色的文本理解和生成能力。但它们在处理领域特定信息方面面临挑战&#xff0c;比如当查询超出训练数据范围时&#xff0c;它们会产生错误的答案。LLMs 的推理过程也缺乏透明度&#xff0c;使用户难以理解达成结论…

Qt之条件变量QWaitCondition详解

QWaitCondition内部实现结构图&#xff1a; 相关系列文章 C之Pimpl惯用法 目录 1.简介 2.示例 2.1.全局配置 2.2.生产者Producer 2.3.消费者Consumer 2.4.测试例子 3.原理分析 3.1.辅助函数CreateEvent 3.2.辅助函数WaitForSingleObject 3.3.QWaitConditionEvent …

C++笔记1:操纵符输入输出

C操纵符用来控制输出控制&#xff0c;一是输出的形式&#xff0c;二是控制补白的数量和位置。本文记录一下&#xff0c;在一些笔试的ACM模式可能有用。其中1-4节的部分是关于格式化输入输出操作&#xff0c;5-6节的部分是关于未格式化输入输出操作。 1. 控制布尔值的格式 一般…

uniapp API文档地址 以及 HBuilder安装

uniapp API文档地址 以及 HBuilder安装 一、进入 当前网站 uni-app 官网 [uni-app](https://zh.uniapp.dcloud.io/quickstart-hx.html)二、点击截图下载文件 三、 进入 当前网站 &#xff08;https://www.dcloud.io/hbuilderx.html&#xff09; 浏览器会识别 也可以自行选择…

基于GIS、RS、VORS模型、CCDM模型、geodetecto、GWR模型集成的生态系统健康的耦合协调分析

详情点击公众号&#xff1a;技术科研吧 链接&#xff1a;基于GIS、RS、VORS模型、CCDM模型、geodetecto、GWR模型集成的生态系统健康的耦合协调分析 前沿 当空间大数据、云计算与人工智能发生碰撞,地理服务产业也不断发生变革与进步。ArcGIS Pro 是一个专业的桌面 GIS 应用程…

17 外排序

排序分为内排序和外排序&#xff0c;内排序是在内存中的排序。外排序指在磁盘中文件的排序&#xff0c;因为在磁盘中&#xff0c;不能进行下标访问&#xff0c;归并排序经常用于磁盘中文件的排序 假如有10亿个整形数据在磁盘中&#xff0c;要对它排序&#xff0c;内存中只有1G…

水果FL Studio21.2最新中文版功能特点介绍

FL Studio 21的特点和优势包括&#xff1a; 丰富的主题换肤&#xff1a;用户可以通过调整色调、饱和度、亮度、文本、仪表和步进序列器的颜色&#xff0c;来个性化定制FL Studio 21的外观&#xff0c;使其更符合个人审美或工作风格。更快的音频编辑&#xff1a;FL Studio 21集…

AI少女/HS2甜心选择2 仿剑三剑灵人物卡全合集打包

AI少女/HS2甜心选择2 仿剑三剑灵人物卡全合集打包 内含&#xff1a;菩提禅音[剑网3]明教晓天喵姐[剑3]明教晓天喵姐无帽版[剑3]茱莉亚[剑灵] 下载地址&#xff1a; https://www.changyouzuhao.cn/12492.html

软件价值12-射箭游戏

射箭游戏&#xff0c;按空格键发射&#xff0c;打击移动靶&#xff0c;左上角显示成绩状态。 代码&#xff1a; import pygame import sys import random# 初始化Pygame pygame.init()# 设置窗口大小 SCREEN_WIDTH 800 SCREEN_HEIGHT 600 screen pygame.display.set_mode((…

【开源】基于JAVA+Vue+SpringBoot的就医保险管理系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 科室档案模块2.2 医生档案模块2.3 预约挂号模块2.4 我的挂号模块 三、系统展示四、核心代码4.1 用户查询全部医生4.2 新增医生4.3 查询科室4.4 新增号源4.5 预约号源 五、免责说明 一、摘要 1.1 项目介绍 基于JAVAVue…

DS:树及二叉树的相关概念

创作不易&#xff0c;兄弟们来波三连吧&#xff01;&#xff01; 一、树的概念及结构 1.1 树的概念 树是一种非线性的数据结构&#xff0c;它是由n&#xff08;n>0&#xff09;个有限结点组成一个具有层次关系的集合。把它叫做树是因为它看起来像一棵倒挂的树&#xff0c…
最新文章