使用PHP制作 简易员工管理系统之一(创建数据库)

一、首先建立数据库usersDb;create database usersDb;二、建立两张表 admin与userscreate table admin( id int primary key, password varchar(64) not null, name varchar(32) not null);create table users( id int
摘要由CSDN通过智能技术生成

一、首先建立数据库usersDb;

create database usersDb;

二、建立两张表 admin与users

create table admin(
    id int primary key,
    password varchar(64) not null,
    name varchar(32) not null
);
create table users(
    id int primary key auto_increment,
    name varchar(64) not null,
    grade tinyint,
    email varchar(64) not null,
    sa
  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
小皮面板是一个基于 Nginx 的 Web 服务器面板,可以用来快速搭建 Web 服务器。下面是一个使用小皮面板的 PHP 简易学生管理系统示例代码: 1. 首先,在小皮面板中创建一个网站,将网站根目录设置为 `/www/student`。 2. 在 `/www/student` 目录下创建一个 `index.php` 文件,将以下代码复制粘贴到文件中: ```php <!DOCTYPE html> <html> <head> <title>学生管理系统</title> </head> <body> <h1>学生管理系统</h1> <a href="add.php">添加学生</a> <a href="list.php">学生列表</a> </body> </html> ``` 3. 在 `/www/student` 目录下创建一个 `add.php` 文件,将以下代码复制粘贴到文件中: ```php <!DOCTYPE html> <html> <head> <title>添加学生</title> </head> <body> <h1>添加学生</h1> <form action="save.php" method="post"> <p> <label>姓名:</label> <input type="text" name="name" required> </p> <p> <label>年龄:</label> <input type="number" name="age" required> </p> <p> <label>性别:</label> <input type="radio" name="gender" value="male" checked>男 <input type="radio" name="gender" value="female">女 </p> <p> <button type="submit">添加</button> <button type="reset">重置</button> </p> </form> </body> </html> ``` 4. 在 `/www/student` 目录下创建一个 `save.php` 文件,将以下代码复制粘贴到文件中: ```php <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $name = $_POST['name']; $age = $_POST['age']; $gender = $_POST['gender']; // 将学生信息保存到数据库中 // ... header('Location: list.php'); exit(); } ?> ``` 5. 在 `/www/student` 目录下创建一个 `list.php` 文件,将以下代码复制粘贴到文件中: ```php <!DOCTYPE html> <html> <head> <title>学生列表</title> </head> <body> <h1>学生列表</h1> <table> <thead> <tr> <th>姓名</th> <th>年龄</th> <th>性别</th> </tr> </thead> <tbody> <?php // 从数据库中获取学生列表 // ... foreach ($students as $student) { echo '<tr>'; echo '<td>' . $student['name'] . '</td>'; echo '<td>' . $student['age'] . '</td>'; echo '<td>' . ($student['gender'] == 'male' ? '男' : '女') . '</td>'; echo '</tr>'; } ?> </tbody> </table> </body> </html> ``` 这样,你就创建了一个简单的 PHP 学生管理系统,并且可以使用小皮面板来快速部署和管理。注意,上面的代码仅作为示例,实际应用中需要根据自己的需求进行修改和完善。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值