1.对题型表的操作
(1).读取题型表(tb_style)中的数据(read_style.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_style where sty_select!='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result);
if($result){
echo "操作成功!";
echo "$row[0]";
echo "$row[1]";
}else{
echo "操作失败,请重试。";
}
?>
(2).1).添加题型表单(addstyle.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<form name="form1" action="add_style.php" method=post>
<p align="center">题型编号:<input type="text" name="sty_style"></input></p>
<p align="center">题型:<input type="text" name="sty_name"></input></p>
<p align="center"><input type="submit" name="send" value="添加"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).添加题型(add_style.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="insert into tb_style values('".$_POST['sty_style']."','".$_POST['sty_name']."','0')";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "添加题型成功!";
echo $_POST['sty_style'];
echo $_POST['sty_name'];
}else{
echo "操作失败,请重试。";
}
?>
(3).1)删除题型表单(deletestyle.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>删除题目类型表单</title>
</head>
<body>
<form name="form1" action="delete_style.php" method=post>
<p align="center">题型编号:<input type="text" name="sty_id"></input></p>
<p align="center"><input type="submit" name="send" value="删除"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).删除题型(delete_style.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="update tb_style set sty_select='1' where sty_style='".$_POST['sty_id']."'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "删除题型成功!";
echo $_POST['sty_style'];
echo $_POST['sty_select'];
}else{
echo "操作失败,请重试。";
}
?>
2.对题库管理员的操作
(1).读取时间最近的题库管理员用户(100条数据)(read_admin.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_admin where adm_select!='0' order by adm_register desc";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
$a=mysql_num_rows($result);
if($result){
echo "<table>";
echo("<tr><td>登录账户</td><td>用户姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
for($a=0; $a<=100; $a++)
{
while($row = mysql_fetch_row($result)) echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td>
<td>$row[6]</td></tr>"; //显示数据
}
echo "</table>";
}else{
echo "暂时没有数据。";
}
?>
(2).1).更新题库管理员用户表单(pupdate_admin.php)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf8"></meta>
<title>修改用户</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple"
alink="red">
<?php
$sqlstr="select adm_login from tb_admin where adm_select='0';";
$result=mysql_query($sqlstr,$link);
if($result){
echo "操作成功";
}else{
echo "操作失败";
}
?>
<h2 align="center">选择要修改的用户</h2><center>
<form name="form1" action=update_admin.php method=post>
<SELECT name="adm_login" size="1">
<?php while($row=mysql_fetch_array($result,MYSQL_BOTH)){
echo "<OPTION>".$row["adm_login"];
}
?>
</SELECT>
<p align="center">用户姓名:<input type="text" name="adm_name"></input></p><br></br>
<p align="center">身份证号:<input type="text" name="adm_id"></input></p><br></br>
<p align="center">用户密码:<input type="password" name="adm_password"></input></p><br></br>
<p align="center">确认密码:<input type="password" name="adm_repassword"></input></p><br></br>
<p align="center">性别:<input type="radio" name="adm_sex" value="男">男<input type="radio" name="adm_sex" value="女">女
<p align="center">用户住址:<input type="text" name="adm_address"></input><br></br>
<input type="submit" name="提交" value='提交'><input type="reset" name="重设" value='取消'></input><br></br>
</form><br><br></br>
</html>
2).更新题库管理员用户(update_admin.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<?php
//检查数据
if($_POST['adm_name']=='' or $_POST['adm_id']==''or $_POST['adm_password']==''or $_POST['adm_repassword']==''
or $_POST['adm_sex']==''or $_POST['adm_address']==''){
echo "字段不可空白";
exit;
}
if($_POST['adm_password']!=$_POST['adm_repassword']){
echo "两次输入的密码不相同,请重新输入";
exit;
}
$sqlstr="update tb_admin set adm_name='".$_POST['adm_name']."',adm_id='".$_POST['adm_id']."',adm_password='".$_POST['adm_password']."'
,adm_sex='".$_POST['adm_sex']."',adm_address='".$_POST['adm_address']."',adm_register=now(),adm_select='0'
where adm_login='".$_POST['adm_login']."'";
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "更改用户资料成功";
}else{
echo "更改用户失败";
}
?>
(3).1).删除题库管理员用户表单(delete_admin.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>删除管理员用户</title>
</head>
<body>
<form name="form1" action=delete_admin.php method=post>
<p align="center">请选择您要删除管理员用户:<input type="text" name="adm_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).删除题库管理员用户(delete_admin.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="update tb_admin set adm_select='1' where adm_login='".$_POST['adm_login']."'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "删除管理员成功!";
}else{
echo "操作失败,请重试。";
}
?>
(4).1).查找题库管理员账户表单(search_adm_login.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找帐户</title>
</head>
<body>
<form name="form1" action=search_adm_login.php method=post>
<p align="center">请选择您要查找的用户:<input type="text" name="adm_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).查找题库管理员账户(search_adm_login.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_admin where adm_login='".$_POST['adm_login']."' and adm_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>登录账户</td><td>用户姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
(5).1).查找题库管理员姓名表单(search_adm_name.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找姓名</title>
</head>
<body>
<form name="form1" action=search_adm_name.php method=post>
<p align="center">请选择您要查找的姓名:<input type="text" name="adm_name"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).查找题库管理员姓名(search_adm_name.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_admin where adm_name='".$_POST['adm_name']."' and adm_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>登录账户</td><td>用户姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
3.对改卷老师的操作
(1).读取时间最近的改卷老师用户(300条数据)(read_teacher.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_teacher where tea_select!='0' order by tea_register desc";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
$a=mysql_num_rows($result);
if($result){
echo "<table>";
echo("<tr><td>老师账户</td><td>老师姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
for($a=0; $a<=300; $a++)
{
while($row = mysql_fetch_row($result)) echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td>
<td>$row[6]</td></tr>"; //显示数据
}
echo "</table>";
}else{
echo "暂时没有数据。";
}
?>
(2).1).更新老师用户表单(pupdate_teacher.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf8"></meta>
<title>修改老师用户</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple"
alink="red">
<?php
$sqlstr="select tea_login from tb_teacher where tea_select='0'";
$result=mysql_query($sqlstr,$link);
if($result){
echo "操作成功";
}else{
echo "操作失败";
}
?>
<h2 align="center">选择要修改的老师用户</h2><center>
<form name="form1" action=update_teacher.php method=post>
<SELECT name="tea_login" size="1">
<?php while($row=mysql_fetch_array($result,MYSQL_BOTH)){
echo "<OPTION>".$row["tea_login"];
}
?>
</SELECT>
<p align="center">老师姓名:<input type="text" name="tea_name"></input></p><br></br>
<p align="center">身份证号:<input type="text" name="tea_id"></input></p><br></br>
<p align="center">用户密码:<input type="password" name="tea_password"></input></p><br></br>
<p align="center">确认密码:<input type="password" name="tea_repassword"></input></p><br></br>
<p align="center">性别:<input type="radio" name="tea_sex" value="男">男<input type="radio" name="tea_sex" value="女">女
<p align="center">用户住址:<input type="text" name="tea_address"></input><br></br>
<input type="submit" name="提交" value='提交'><input type="reset" name="重设" value='取消'></input><br></br>
</form><br><br></br>
</html>
2).更新老师用户(update_teacher.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<?php
//检查数据
if($_POST['tea_name']=='' or $_POST['tea_id']==''or $_POST['tea_password']==''or $_POST['tea_repassword']==''
or $_POST['tea_sex']==''or $_POST['tea_address']==''){
echo "字段不可空白";
exit;
}
if($_POST['tea_password']!=$_POST['tea_repassword']){
echo "两次输入的密码不相同,请重新输入";
exit;
}
$sqlstr="update tb_teacher set tea_name='".$_POST['tea_name']."',tea_id='".$_POST['tea_id']."',tea_password='".$_POST['tea_password']."'
,tea_sex='".$_POST['tea_sex']."',tea_address='".$_POST['tea_address']."',tea_register=now(),tea_select='0'
where tea_login='".$_POST['tea_login']."'";
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "更改用户资料成功";
}else{
echo "更改用户失败";
}
?>
(3).1).删除老师用户表单(delete_teacher.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>删除老师用户</title>
</head>
<body>
<form name="form1" action=delete_teacher.php method=post>
<p align="center">请选择您要删除的老师用户:<input type="text" name="tea_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).删除老师用户(delete_teacher.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="update tb_teacher set tea_select='1' where tea_login='".$_POST['tea_login']."'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "删除老师成功!";
}else{
echo "操作失败,请重试。";
}
?>
(4).1).查找老师账户表单(search_tea_login.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找老师帐户</title>
</head>
<body>
<form name="form1" action=search_tea_login.php method=post>
<p align="center">请选择您要查找的用户:<input type="text" name="tea_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).查找老师账户(search_tea_login.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_teacher where tea_login='".$_POST['tea_login']."' and tea_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>登录账户</td><td>用户姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
(5).1).查找老师姓名表单(search_tea_name.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找老师</title>
</head>
<body>
<form name="form1" action=search_tea_name.php method=post>
<p align="center">请选择您要查找的老师:<input type="text" name="tea_name"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
2).查找老师姓名(search_tea_name.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_teacher where tea_name='".$_POST['tea_name']."' and tea_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>老师账户</td><td>老师姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
3.对学生的操作
(1).读取时间最近的学生用户(300条数据)(read_student.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_student where stu_select!='0' order by stu_register desc";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
$a=mysql_num_rows($result);
if($result){
echo "<table>";
echo("<tr><td>学生账户</td><td>学生姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
for($a=0; $a<=300; $a++)
{
while($row = mysql_fetch_row($result)) echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td>
<td>$row[6]</td></tr>"; //显示数据
}
echo "</table>";
}else{
echo "暂时没有数据。";
}
?>
![](https://pic002.cnblogs.com/img/lizhaoyi/201005/2010050813544090.jpg)
(2).1).更新学生用户表单(pupdate_student.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf8"></meta>
<title>修改学生用户</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple"
alink="red">
<?php
$sqlstr="select stu_login from tb_student where stu_select='0'";
$result=mysql_query($sqlstr,$link);
if($result){
echo "操作成功";
}else{
echo "操作失败";
}
?>
<h2 align="center">选择要修改的学生用户</h2><center>
<form name="form1" action=update_student.php method=post>
<SELECT name="stu_login" size="1">
<?php while($row=mysql_fetch_array($result,MYSQL_BOTH)){
echo "<OPTION>".$row["stu_login"];
}
?>
</SELECT>
<p align="center">学生姓名:<input type="text" name="stu_name"></input></p><br></br>
<p align="center">学生证号:<input type="text" name="stu_id"></input></p><br></br>
<p align="center">用户密码:<input type="password" name="stu_password"></input></p><br></br>
<p align="center">确认密码:<input type="password" name="stu_repassword"></input></p><br></br>
<p align="center">性别:<input type="radio" name="stu_sex" value="男">男<input type="radio" name="stu_sex" value="女">女
<p align="center">用户住址:<input type="text" name="stu_address"></input><br></br>
<input type="submit" name="提交" value='提交'><input type="reset" name="重设" value='取消'></input><br></br>
</form><br><br></br>
</html>
2).更新学生用户(update_student.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
?>
<?php
//检查数据
if($_POST['stu_name']=='' or $_POST['stu_id']==''or $_POST['stu_password']==''or $_POST['stu_repassword']==''
or $_POST['stu_sex']==''or $_POST['stu_address']==''){
echo "字段不可空白";
exit;
}
if($_POST['stu_password']!=$_POST['stu_repassword']){
echo "两次输入的密码不相同,请重新输入";
exit;
}
$sqlstr="update tb_student set stu_name='".$_POST['stu_name']."',stu_id='".$_POST['stu_id']."',stu_password='".$_POST['stu_password']."'
,stu_sex='".$_POST['stu_sex']."',stu_address='".$_POST['stu_address']."',stu_register=now(),stu_select='0'
where stu_login='".$_POST['stu_login']."'";
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "更改用户资料成功";
}else{
echo "更改用户失败";
}
?>
(3).1).删除学生用户表单(delete_student.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>删除学生用户</title>
</head>
<body>
<form name="form1" action=delete_student.php method=post>
<p align="center">请选择您要删除的学生用户:<input type="text" name="stu_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
![](https://pic002.cnblogs.com/img/lizhaoyi/201005/2010050814003115.jpg)
2).删除学生用户(delete_student.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="update tb_student set stu_select='1' where stu_login='".$_POST['stu_login']."'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
if($result){
echo "删除学生成功!";
}else{
echo "操作失败,请重试。";
}
?>
(4).1).查找学生账户表单(search_stu_login.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找学生帐户</title>
</head>
<body>
<form name="form1" action=search_stu_login.php method=post>
<p align="center">请选择您要查找的学生用户:<input type="text" name="stu_login"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
![](https://pic002.cnblogs.com/img/lizhaoyi/201005/2010050814024130.jpg)
2).查找学生账户(search_stu_login.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_student where stu_login='".$_POST['stu_login']."' and stu_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>学生账户</td><td>学生姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
(5).1).查找学生姓名表单(search_stu_name.html):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查找学生</title>
</head>
<body>
<form name="form1" action=search_stu_name.php method=post>
<p align="center">请选择您要查找的学生:<input type="text" name="stu_name"></input></p>
<p align="center"><input type="submit" name="send" value="提交"><input type="reset" name="重设" value="取消"></p>
</form>
</body>
</html>
![](https://pic002.cnblogs.com/img/lizhaoyi/201005/2010050814053087.jpg)
2).查找学生姓名(search_stu_name.php):
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<?php
//检查数据
/* Connectint,selecting database */
$link=mysql_connect('localhost','root','lizhaoyi')
or die("Could not connect:".mysql_error());
//echo "Connected successfully";
mysql_select_db("db_testsystem") or die("Could not select database");
mysql_query("set names utf8");
$sqlstr="select * from tb_student where stu_name='".$_POST['stu_name']."' and stu_select='0'";
//组合sql
$result=mysql_query($sqlstr,$link);
//执行sql
//跳至窗口页
$row=mysql_fetch_array($result,MYSQL_BOTH);
if(mysql_num_rows($result)==1){
echo "查找成功"."<br>";
echo "用户的资料如下:";
echo "<table>";
echo("<tr><td>学生账户</td><td>学生姓名</td><td>身份证号</td><td>用户密码</td><td>用户性别</td><td>用户住址</td><td>注册时间</td></tr>");
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td></tr>"; //显示数据
echo "</table>";
}else{
echo "查找失败";
}
?>
![](https://pic002.cnblogs.com/img/lizhaoyi/201005/2010050814072183.jpg)