PHP+Mysql—学生信息管理系统

一、功能

前台功能:
1、学生信息查看
2、学生信息添加
3、学生信息修改
4、学生信息删除

二、工具

PHP编程: Sublime Text、phpstorm…
SQL: mysql
环境搭建: PHP study(PHP 5.5 + Apache)

三、效果展示

网站首页:
在这里插入图片描述
添加学生信息:
在这里插入图片描述
修改学生信息:
在这里插入图片描述
删除学生信息:
在这里插入图片描述
查找学生信息:
在这里插入图片描述

四、网站核心代码示例

update_userpass.php 文件为例:
(采用的PDO预编译方法编写)

<?php
header("content-Type:text/html;charset=utf-8;");
//连接数据库
include 'conn.php';

$sql = "select * from student";
$date = $pdo->query($sql);

?>

<html>
	<head>
		<meta charset="UTF-8">
		<title>学生信息管理系统</title>
	</head>
	<style type="text/css">
		body {
			background-image: url(student.jpg);
			background-size: 100%;
		}

		.wrapper {
			width: 1000px;
			margin: 20px auto;
		}

		h1 {
			text-align: center;
		}

		.add {
			margin-bottom: 20px;
		}

		.add a {
			text-decoration: none;
			color: #fff;
			background-color: #00CCFF;
			padding: 6px;
			border-radius: 5px;
		}

		td {
			text-align: center;
		}
	</style>
	<body>
		<div class="wrapper">
			<h1>学生信息管理系统</h1>
			<div class="add">
				<a href="addStudent.html">添加学生</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="searchStudent.html">查找学生</a>
			</div>
			<table width="960" border="1">
				<tr>
					<th>编号</th>
					<th>姓名</th>
					<th>性别</th>
					<th>年龄</th>
					<th>学历</th>
					<th>工资</th>
					<th>奖金</th>
					<th>籍贯</th>
					<th>操作</th>
				</tr>
				<?php



                foreach ($date as $key => $arr){

  				echo "<tr>";
				echo "<td>{$arr['id']}</td>";
				echo "<td>{$arr['name']}</td>";
				echo "<td>{$arr['sex']}</td>";
				echo "<td>{$arr['age']}</td>";
				echo "<td>{$arr['edu']}</td>";
				echo "<td>{$arr['salary']}</td>";
				echo "<td>{$arr['bonus']}</td>";
				echo "<td>{$arr['city']}</td>";
				echo "<td>
							<a href='javascript:del({$arr['id']})'>删除</a>
							<a href='editStudent.php?id={$arr['id']}'>修改</a>
					  </td>";
				echo "</tr>";
  				// echo "<pre>";
 				// print_r($arr);
  				// echo "</pre>";


				}



			?>

			</table>
		</div>

		<script type="text/javascript">
			function del(id) {
				if (confirm("确定删除这个学生吗?")) {
					window.location = "action_del.php?id=" + id;
				}
			}
		</script>



	</body>
</html>


网站代码结构:

在这里插入图片描述

  • 5
    点赞
  • 65
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值