简单的学⽣成绩管理系统(PHP+MySql)
要求
1、合理设计数据表,正确连接MySQL数据库。
2、主界⾯能够选择:学⽣表查询、学⽣表录⼊、课程表查询、课程表录⼊、成绩表查询、成绩表录⼊六⼤功能。
3、学⽣表录⼊页⾯可以按学号查询某学⽣详细信息,可以添加、修改、删除⼀个学⽣的信息。
4、学⽣表查询界⾯能够显⽰全部学⽣表信息,可以按照表中3个字段进⾏查询信息,有分页导航功能。
5、课程表录⼊页⾯可以按课程号查询某课程的详细信息,可以添加、修改、删除⼀个课程的信息。
6、课程表查询界⾯能够显⽰全部课程表信息,可以按照表中2个字段进⾏查询信息,有分页导航功能。
7、成绩表录⼊页⾯能够录⼊成绩。
8、成绩表查询界⾯能够查询成绩。
9、设计新颖,说明⽂档逻辑清楚,内容完整。
代码
1. index.php
<html>
<head>
<title>学⽣成绩管理系统</title>
</head>
<body>
<style type="text/css">
body{
background:url("888.jpg") no-repeat;
background-size:100%;
}
div{
font-size:24px;
font-weight: bold;
color:#000000;
margin-bottom:10px;
}
</style>
<div>
<li><a href="kccx.php" target="test">课程表查询</a></li>
<li><a href="kcb.php" target="test">课程表录⼊</a></li>
<li><a href="xscx.php" target="test">学⽣表查询</a></li>
<li><a href="xsb.php" target="test">学⽣表录⼊</a></li>
<li><a href="cjcx.php" target="test">成绩表查询</a></li>
<li><a href="cjb.php" target="test">成绩表录⼊</a></li>
<tr>
<td  align="center" valign="middle">
<iframe src="" height="800px" width="1200px" name="test" id="test" scrolling="yes" frameborder="0"></iframe>
</td>
</tr>
</div>
</body>
</html>
2. cjb.php
<html>
<head>
<title>成绩表信息更新</title>
<style type="text/css">
table{margin:0 auto;}
td{text-align:center;}
</style>
</style>
</head>
<body>
<h1 >成绩表录⼊</h1>
<form name="frm1" method="post">
<table align="center">
<tr>
<td width="120"><span>根据课程号查询:</span></td>
<td>
<input name="KCNumber" id="KCNumber" type="text">
<input type="submit" name="test" value="查">
</td>
</tr>
</table>
mysql面试题学生表</form>
<?php
$conn=mysqli_connect("localhost","root","123456","XSCJ");
mysqli_set_charset($conn,"utf8");
$KCNumber=@$_POST['KCNumber'];
$sql="select * from cjb where 课程号='$KCNumber'";
$result=mysqli_query($conn,$sql);
$row=@mysqli_fetch_array($result);
//print_r($row);//取得查询结果
if(($KCNumber!=NULL)&&(!$row))
echo"<script>alert('没有该课程信息!')</script>";
>
<form name="frm2" method="post" enctype="multipart/form-data">
<table border="1" align="center">
<tr>
<td><span>课程号:</span></td>
<td>
<input name="KCNum" type="text" value="<?php echo $row['课程号'];?>">
<input name="h_KCNum" type="hidden" value="<?php echo $row['课程号'];?>">
</td>
</tr>
<tr>jsonobject序列化
<td><span>课程名:</span></td>
<td><input name="KCName" type="text" value="<?php echo $row['课程名'];?>"></td> </tr>
<tr>
<td><span>成绩:</span></td>
<td><input name="CJ" type="text" value="<?php echo $row['成绩'];?>"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input name="b" type="submit" value="修改"> 
<input name="b" type="submit" value="添加"> 
<input name="b" type="submit" value="删除"> 
</td>
matlab plot棕
</tr>
</table>
</form>
</body>
</html>
<?php
$KCH=@$_POST['KCNum'];
$h_KCH=@$_POST['h_KCNum'];
$KCM=@$_POST['KCName'];
$CJ=@$_POST['CJ'];
function test($KCH,$KCM,$CJ)
{
if(!$KCH)
如何telnet端口echo"<script>alert('课程号不能为空!');location.href='cjb.php';</script>";
elseif(!$KCM)
elseif(!$KCM)
echo"<script>alert('课程名不能为空!');location.href='cjb.php';</script>";
elseif(!is_numeric($CJ))
echo"<script>alert('学分必须为数字!');location.href='cjb.php';</script>";
}
/
/单击【修改】按钮
if(@$_POST["b"]=='修改')
{
怎样做网址test($KCH,$KCM,$CJ);
if($KCH!=$h_KCH)
echo"<script>alert('课程号与原数据有异,⽆法修改!');</script>";
else{
$update_sql="update CJB set 课程名='$KCM',成绩='$CJ' where 课程号='$KCH'";
$update_result=mysqli_query($conn,$update_sql);
if(mysqli_affected_rows($conn)!=0)
echo"<script>alert('修改成功!');</script>";
else
echo"<script>alert('信息未修改!');</script>";
}
}
//单击【添加】按钮
if(@$_POST["b"]=='添加')
{
test($KCH,$KCM,$CJ);
$s_sql="select 课程号 from cjb where 课程号='$KCH'";
$s_result=mysqli_query($conn,$s_sql);
$s_row=@mysqli_fetch_array($s_result);
if($s_row)
echo"<script>alert('课程已存在,⽆法添加!');</script>";
else{
$insert_sql="insert into cjb (课程号,课程名,成绩) values('$KCH','$KCM',$CJ)";
$insert_result=mysqli_query($conn,$insert_sql)or die('添加失败!');
if(mysqli_affected_rows($conn)!=0)
echo"<script>alert('添加成功!');</script>";
}
}
//单击【删除】按钮
if(@$_POST["b"]=='删除')
{
if(!$KCH)
{
echo"<script>alert('请输⼊要删除的课程号!');</script>";
}
else{
$d_sql="select 课程号 from cjb where 课程号='$KCH'";
$d_result=mysqli_query($conn,$d_sql);
$d_row=mysqli_fetch_array($d_result);
if(!$d_row)
echo"<script>alert('课程号不存在,⽆法删除!');</script>";
else{
$del_sql="delete from cjb where 课程号='$KCH'";
$del_result=mysqli_query($conn,$del_sql)or die('删除失败!');
if(mysqli_affected_rows($conn)!=0)
echo"<script>alert('删除课程".$KCH."成功!');</script>";
}
}
}
>
3. cjcx.php
<html>
<head>
<head>
<title>成绩查询</title>
<style type="text/css">
div{
text-align: center;
font-size:24px;
font-weight: bold;
color:"#008000";
}
table{
width:300px;
}
</style>
</head>
<body>
<h1 >成绩表操作</h1>
<form name="frm1" method="get">
<table align="center">
<tr>
<td nowrap bgcolor="#ccc">课程号:</td>
<td><input name="KCNumber" size="13" type="text"></td>
<td nowrap bgcolor="#ccc">课程名:</td>
<td><input name="KCName" size="13" type="text"></td>
<td nowrap bgcolor="#ccc">成绩:</td>
<td><input name="CJ" size="13" type="text"></td>
<td nowrap>
<input type="submit" name="Query" value="查询">
</td>
</tr>
</table>
</form>
<?php单片机编程好学吗
$conn=mysqli_connect("localhost","root","123456","XSCJ");
mysqli_set_charset($conn,"utf8");//设置字符集
$KCNumber=@$_GET['KCNumber'];//获取课程号
$KCName=@$_GET['KCName'];//获取课程名
$CJ=@$_GET['CJ'];//获取成绩
function getsql($KCNumber,$KCName,$CJ){
$sql="select *from CJB where ";
$note=0;
if($KCNumber){
$sql.="课程号 like'%$KCNumber%'";
$note=1;
}
if($KCName){
if($note==1){
$sql.=" and 课程名 like '%$KCName%'";
echo"<script>alert('sql=".$spl."')</script>";
}else{
$sql.="课程名 like '%$KCName%'";
}
$note=1;
}
if($CJ){
if($note==1){
$sql.=" and 成绩 like '%$CJ%'";
echo"<script>alert('sql=".$spl."')</script>";
}else{
$sql.="成绩 like '%$CJ%'";
}
$note=1;
}
if($note==0){
$sql="select * from cjb";
}
}
return$sql;
}
$sql=getsql ($KCNumber,$KCName,$CJ);
$result=mysqli_query($conn,$sql);
$total=mysqli_num_rows($result);
if(!$result){
printf("Error: %s\n",mysqli_error($conn));
exit();
}
$page=isset($_GET['page'])?intval($_GET['page']):1;
$num=3;
$url='cjcx.php';
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);
$prepg=$page-1;
$nextpg=($page==$pagenum?0:$page+1);
$new_sql=$sql." limit ".($page-1)*$num.",".$num;
$new_result=mysqli_query($conn,$new_sql);
if($new_row=@mysqli_fetch_array($new_result)){
echo"<br><div alige=center><font>学⽣成绩查询结果</font></div>";
echo"<br>";
echo"<table width=500 border=1 align=center>";
echo"<tr><td>课程号</td>";
echo"<td>课程名</td>";
echo"<td>成绩</td></tr>";
do{
list($KCH,$KCM,$CJ)=$new_row;
echo"<tr><td>$KCH</td>";
echo"<td>$KCM</td>";
echo"<td>$CJ</td></tr>";
}while($new_row=mysqli_fetch_array($new_result));
echo"</table>";
$pagenav="";
if($prepg){
$pagenav.="<a href='$url?page=$prepg&KCNumber=$KCNumber&KCName=$KCName&CJ=$CJ'>上⼀页</a>"; }
for($i=1;$i<=$pagenum;$i++){
if($page==$i){
$pagenav.=$i." ";
}else{
$pagenav.="<a href='$url?page=$i&KCNumber=$KCNumber&KCName=$KCName&CJ=$CJ'>$i</a>";
}
}
if($nextpg){
$pagenav.="<a href='$url?page=$nextpg&KCNumber=$KCNumber&KCName=$KCName&CJ=$CJ'>下⼀页</a>"; }
$pagenav.="共(".$pagenum.")页";
echo"<br><div alige=center>".$pagenav."</div>";
}
>
4. kcb.php
<html>
<head>
<meta charset="UTF-8">
<title>课程信息更新</title>
<style type="text/css">
table{margin:0 auto;}
td{text-align:center;}
</style>
</head>
<body>