PHP+Mysql制作一个学生成绩查询模块

我不是学PHP的我只是需要用一下PHP要是学又得好长时间,最好的方法就是问,但是问会的,又说让百度,得,我直接自己干吧,便花费了我一整天时间做了一下,从网上搜集,看视频,终于写出来了一个简单的成绩查询模块可能有点简陋但是基本的功能也都实现了

这是文档结构,就两个文档一个前端HTML,一个后端PHP,那个图片是背景图片

然后来看看前端效果PS:感谢百度出来的某位大佬写的前端界面,真的是太好看了

然后来看看查询结果

看看数据库结构(此处用的是PHPMYadmin)

看看数据库内容

  • 此处要说怎么把数据导入进去,学校出来的成绩只能是Excel的表,百度上确实有这个步骤和过程我就不详细说了
我粘代码
前端html代码(文件名称index.html)
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><title>Title</title><style>* {margin: 0;padding: 0;}html, body {width: 100%;height: 100%;}body {background-image: url(back.jpg);background-size: 100%;background-repeat: no-repeat;background-attachment: fixed;margin-left: 0px;margin-top: 0px;}.loginFrame {width: 700px;height: 400px;background: rgba(0, 0, 0, 0.3);/*元素上下左右都居中*/position: fixed;margin: auto;top: 0;bottom: 0;left: 0;right: 0;border-radius: 10px;padding: 50px 0;box-sizing: border-box;box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4);}.loginFrame > div {width: 350px;height: 50px;margin: 40px auto;color: white;}.loginFrame > p {text-align: center;color: white;font-size: 25px;}.loginFrame > div span {display: inline-block;cursor: pointer;}.loginFrame > div input {width: 100%;height: 30px;background: transparent;border: none;border-bottom: 1px solid white;outline: none;color: white;}.loginFrame .enterBut {width: 200px;height: 50px;border-radius: 50px;background-image: linear-gradient(to right, #c979d4, #fa719d);text-align: center;padding-top: 10px;box-sizing: border-box;font-size: 20px;cursor: pointer;}.loginFrame .enterBut:hover {box-shadow: 0 0 10px rgba(0, 0, 0, .5) inset;}input::-webkit-input-placeholder { /* WebKit browsers 适配谷歌 */color: #BDCADA;}svg {vertical-align: bottom;}</style>
</head>
<body><div class="main"><form action="chaxun.php" method="GET">    <!--这里是提交form表单提交方式设置-->    <div class="loginFrame"><p class="loginTitle">成绩查询</p><div class="user"><label><span><svg class="icon" height="20" p-id="3807" t="1586442913188"version="1.1" viewBox="0 0 1024 1024" width="20" xmlns="http://www.w3.org/2000/svg"><pathd="M517.632 552.149333c-108.714667 0-197.162667-85.546667-197.162667-190.72 0-38.314667 11.690667-75.306667 33.877334-106.922666C391.04 202.026667 452.138667 170.666667 517.632 170.666667c65.408 0 126.464 31.274667 163.2 83.712 7.765333 11.093333 14.250667 22.869333 19.413333 35.072a21.333333 21.333333 0 1 1-39.338666 16.64 147.285333 147.285333 0 0 0-15.018667-27.221334C617.130667 237.824 569.173333 213.333333 517.632 213.333333c-51.626667 0-99.584 24.533333-128.426667 65.621334a143.445333 143.445333 0 0 0-26.069333 82.432c0 81.664 69.290667 148.096 154.453333 148.096 63.402667 0 119.722667-36.437333 143.36-92.8a21.333333 21.333333 0 0 1 39.338667 16.512c-30.378667 72.277333-102.016 118.954667-182.656 118.954666"fill="#ffffff" p-id="3808"></path><pathd="M303.829333 627.456c-49.92 0-90.453333 41.088-90.453333 91.605333C213.333333 769.578667 253.866667 810.666667 303.786667 810.666667h416.341333C770.133333 810.666667 810.666667 769.578667 810.666667 719.061333c0-50.517333-40.533333-91.605333-90.453334-91.605333H303.786667zM720.213333 853.333333H303.829333C230.442667 853.333333 170.709333 793.088 170.709333 719.061333 170.666667 645.034667 230.4 584.789333 303.786667 584.789333h416.341333C793.6 584.789333 853.333333 645.034667 853.333333 719.061333 853.333333 793.088 793.6 853.333333 720.213333 853.333333z"fill="#ffffff" p-id="3809"></path></svg></span><span>姓名</span><input maxlength="16" name="student_name" placeholder="   student_name" type="text"></label></div><div class="password"><label><span><svg class="icon" height="20" p-id="4677" t="1586443029761"version="1.1" viewBox="0 0 1024 1024" width="20" xmlns="http://www.w3.org/2000/svg"><pathd="M511.176404 551.030949c-38.584889 0-69.974626 31.392323-69.974626 69.979798 0 15.341899 4.874343 29.909333 14.105859 42.121051 0.192646 0.261172 0.404687 0.513293 0.616727 0.768 17.287758 20.146424 18.545778 34.525091 18.620768 35.842586l0 39.965737c0 20.20202 16.434424 36.631273 36.631273 36.631273 20.20202 0 36.632566-16.434424 36.632566-36.631273l0-40.718222c0-0.457697-0.015515-0.919273-0.060768-1.373091 0-0.03103 0.090505-0.005172 0.095677-0.040081 0.100848-0.919273 0.408566-2.884525 1.343354-5.727677 1.883798-5.712162 6.30303-15.080727 16.707232-27.24202 0.151273-0.177131 0.297374-0.359434 0.439596-0.540444 9.702141-12.399192 14.828606-27.288566 14.828606-43.055838C581.161374 582.424566 549.767758 551.030949 511.176404 551.030949L511.176404 551.030949zM541.580929 644.313212c-24.46998 28.748283-25.667232 49.334303-25.434505 55.091717l0 40.308364c0 2.737131-2.232889 4.963556-4.97002 4.963556-2.737131 0-4.964848-2.226424-4.964848-4.963556L506.211556 699.552323c0-2.954343-0.81196-26.410667-25.903838-55.858424-4.873051-6.601697-7.444687-14.429091-7.444687-22.681859 0-21.126465 17.186909-38.319838 38.313374-38.319838 21.131636 0 38.323717 17.193374 38.323717 38.319838C549.500121 629.536323 546.76299 637.586101 541.580929 644.313212L541.580929 644.313212zM541.580929 644.313212"fill="#ffffff" p-id="4678"></path><pathd="M777.580606 417.122263l-1.989818 0 0-0.232727-36.848485 0 0-101.520808c0-0.67103-0.045253-1.343354-0.126707-2.014384-6.923636-54.061253-33.298101-103.833859-74.272323-140.166465C623.009616 136.546263 569.792646 116.363636 514.505697 116.363636c-60.353939 0-117.095434 23.505455-159.773737 66.177293-42.67701 42.67701-66.176 99.419798-66.176 159.772444l0 74.78303-43.132121 0.025859c-29.812364 0-54.070303 24.256646-54.070303 54.070303l0 383.171232c0 29.818828 24.257939 54.071596 54.070303 54.071596l330.369293 0c0.479677 0 0.954182-0.020687 1.424808-0.065939l198.93398 0c0.469333 0.045253 0.943838 0.065939 1.428687 0.065939 29.808485 0 54.065131-24.252768 54.065131-54.071596L831.645737 471.192566C831.64703 441.378909 807.394263 417.122263 777.580606 417.122263L777.580606 417.122263zM320.246949 342.313374c0-51.889131 20.207192-100.671354 56.899232-137.358222 36.686869-36.69204 85.470384-56.899232 137.358222-56.899232 47.530667 0 93.282263 17.348525 128.806788 48.848162 34.990545 31.021253 57.597414 73.420283 63.733657 119.489939l0 100.495515-386.799192 0.232727L320.245657 342.313374 320.246949 342.313374zM799.954747 854.363798c0 11.773414-9.135838 21.449697-20.69204 22.313374l-0.126707 0L245.423838 876.739232c-12.338424 0-22.37802-10.03701-22.37802-22.375434L223.045818 471.192566c0-12.338424 10.039596-22.379313 22.37802-22.379313l58.984727-0.029737c0.808081 0 1.596768-0.081455 2.373818-0.196525 0.849455 0.135758 1.71701 0.231434 2.606545 0.231434l299.146343 0c0.288323 0.005172 0.731798 0.015515 1.313616 0.015515 1.247677 0 3.152162-0.029737 5.590626-0.156444l105.742222 0c0.656808 0.080162 1.322667 0.135758 2.000162 0.135758l54.398707 0c12.333253 0 22.374141 10.046061 22.374141 22.379313L799.954747 854.363798 799.954747 854.363798zM799.954747 854.363798"fill="#ffffff" p-id="4679"></path></svg></span><span>学号</span><input maxlength="16" name="student_number" placeholder="   student_number" type="text"></label></div><div class="enterBut"><input name="submit" type="submit" id="submit" value="查询"/></div></div></form>
</div>
</body>
</html>
后端PHP代码(文件名称chaxun.php)
<?phpheader("Content-type:text/html;charset=utf-8");$host     = 'localhost';//数据库地址$username = 'root';//数据库登录账号$password = 'root';//数据库登录密码$dbname   = 'db';//你操作数据库的名字$port     = '3306';//数据库地址端口,一般是3306$class    = 0;$number   = 0;$name     = 0;$chainese = 0;$sx       = 0;$english  = 0;$wuli     = 0;$huaxue   = 0;$sw       = 0;$sum      = 0;$banji    = 0;$nianji   = 0;//上面12个变量是对数据库里的成绩的定义$biaoshi = "姓名或学号输入错误";//这是是否查询成功的标志变量//从HTML页面获得所提交表单的内容//你的HTML页面看是什么方式提交如果是GET则这边接收用$_GET//如果是POST则这边接收用$_POST$student_name   = $_GET["student_name"];  //这是学生姓名$student_number = $_GET['student_number'];  //这是学生学号$link = @mysqli_connect($host,$username,$password,$dbname,$port);   // 连接到数据库,此处可以不动更改上面的账户密码之类的就行if($link)//如果连接数据库成功进入这个if{//echo "数据库连接成功!<br>";$result = mysqli_query($link,"select * from exam4 where number = '$student_number'");//这是用PHP执行了一段MYSQL的命令//也就是查询的命令将查询得到的数据把值赋个$result exam4是你要查询这个数据库下的哪个表名字$row=mysqli_fetch_array($result,MYSQLI_ASSOC);//这是将得到的数据转换为数组方便与我们操作if($row["name"]==$student_name)//进行第二次验证如果查到的学号数据与姓名是否对应,如果对应则加入下面的if{$biaoshi = "查询成功";          //将查询成功赋值给标志变量$class    = $row["class"];$number   = $row["number"];$name     = $row["name"];$chainese = $row["chainese"];$sx       = $row["sx"];$english  = $row["english"];$wuli     = $row["wuli"];$huaxue   = $row["huaxue"];$sw       = $row["sw"];$sum      = $row["sum"];$banji    = $row["banji"];$nianji   = $row["nianji"];        //将查询得到的各个数据赋值给各个变量}mysqli_close($link);                //之后关闭数据库,释放资源}else{die('数据库连接失败!');            //如果上面的那个if没有进去则进入这个else显示数据库连接失败,并且退出}?>
<html>                                         <!--以下是对PHP处理过后的数据的显示 --> <head><meta charset="utf-8"><style type="text/css">body {background-image: url(back.jpg);background-size: 100%;background-repeat: no-repeat;background-attachment: fixed;  margin-left: 0px;margin-top: 0px;}</style></head>                                   <!--设置页面背景-->     <body><table width="70%" border="0" cellspacing="1" cellpadding="1" align="center"><tbody><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td><font size="6" color="white" align=center; > 成绩查询结果</font></td></tr><tr><td><font size="4" color="white"><?php echo $biaoshi;?></font></td></tr><tbody></table>       <table width="70%" border="0" cellspacing="1" cellpadding="1" align="center"><tbody><tr><td>&nbsp;</td></tr><tr><td><font size="4" color="white">班级</font></td><td><font size="4" color="white">学号</font></td><td><font size="4" color="white">姓名</font></td><td><font size="4" color="white">语文</font></td><td><font size="4" color="white">数学</font></td><td><font size="4" color="white">英语</font></td><td><font size="4" color="white">物理</font></td><td><font size="4" color="white">化学</font></td><td><font size="4" color="white">生物</font></td><td><font size="4" color="white">总分</font></td><td><font size="4" color="white">班排</font></td><td><font size="4" color="white">年排</font></td></tr><tr><td><font size="4" color="white"><?php echo $class;?></font></td><td><font size="4" color="white"><?php echo $number;?></font></td><td><font size="4" color="white"><?php echo $name;?></font></td><td><font size="4" color="white"><?php echo $chainese;?></font></td><td><font size="4" color="white"><?php echo $sx;?></font></td><td><font size="4" color="white"><?php echo $english;?></font></td><td><font size="4" color="white"><?php echo $wuli;?></font></td><td><font size="4" color="white"><?php echo $huaxue;?></font></td><td><font size="4" color="white"><?php echo $sw;?></font></td><td><font size="4" color="white"><?php echo $sum;?></font></td><td><font size="4" color="white"><?php echo $banji;?></font></td><td><font size="4" color="white"><?php echo $nianji;?></font></td>        <!--HTML中是可以嵌套PHP语句的得用<?php// 你的语句  ?>括号括起来 --> </tr><tbody></table></body>
</html>

不会弄的可以在下面留言哦

PHP+Mysql制作一个学生成绩查询模块相关推荐

  1. html制作学生成绩表,学生成绩查询系统的制作方法——Excel篇

    今天给大家分享一个学生成绩查询系统的制作方法,也是回答一位小伙伴的问题. 我们设计一个简单的模型,同类问题都可以套用这个模型. 话不多说,先上个效果图. 上图中,通过下拉菜单选中不同的姓名,调取不同的 ...

  2. Java综合实践——学生成绩查询系统

    数组是最常用的一种数据结构,利用它可以解决很多较复杂的问题.通过一个"学生成绩查询系统"的设计,提高运用数组和编写较大规模代码的综合能力. "学生成绩查询系统" ...

  3. 公众号学生成绩查询系统

    公众号对于绝大部分老师应该都不陌生吧,很多老师被学校要求撰写编辑公众号文章发布到学校的公众号平台.这种情况在高中.大学比较常见,尤其是大学,很多老师还会邀请同学一起帮忙编辑公众号进行发布.撰写公众号文 ...

  4. 期末课程设计—学生成绩查询系统

    /* *Copyright(c)2017,烟台大学计算机学院 *All right reserved. *文件名:main.cpp sqqueue.h sqqueue.cpp *作者:黄士胜 *完成日 ...

  5. JSP+Mysql 做一个简单的学生成绩查询web系统

    IDEA基于JSP+Mysql 做一个简单的学生成绩查询web系统 目录 一.相关软件的下载和配置环境 Java环境的下载和配置 (1)IDEA的下载和安装 ​ (2)JdK的安装 Tomcat的下载 ...

  6. 学生成绩查询系统(Java实现),你第一个Java小项目

    一.学生成绩查询系统(Java实现) 项目要求(我们可以做的更面向对象一点,灵活处理): 具体思路如下: 1.引入程序需要调用的包 2.创建总程序包 "stuScoreInquirySyst ...

  7. 学生成绩查询html,中学生成绩查询用的一个网站叫什么行

    中学生成绩查询用的一个网站叫什么行以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 中学生成绩查询用的一个网站叫什么行, ...

  8. 学生成绩查询系统(php+mysql)

    学生成绩查询系统(php+mysql)(毕业论文10479字以上,共25页,程序代码,MySQL数据库) 下载全套代码 [项目包含内容]                                ...

  9. 用C语言实现一个学生成绩管理系统 实现学生信息管理。包括:录入、查询、排序等功能。 要求: 用数据文件保存学生基本信息(学号 姓名 课程1 课程2 课程3…) ,利用菜单可以循环实现各个功能。

    用C语言实现一个学生成绩管理系统 题目: 学生成绩管理系统 功能: 实现学生信息管理.包括:录入.查询.排序等功能. 要求: 用数据文件保存学生基本信息(学号 姓名 课程1 课程2 课程3-) ,利用 ...

最新文章

  1. 美国能源部宣布SunShot2020目标完成超90%
  2. VBA 中判断汉字的方法
  3. 关于DOM2级事件的事件捕获和事件冒泡
  4. javascript 中的暗物质 - 闭包
  5. 记录用户转成超级用户的文件名字_一分钟了解Linux用户
  6. python 类型转换操作
  7. Pytorch——计算机视觉工具包:torchvision
  8. 2015 2020 r4烧录卡 区别_【2015年和2020年上半年市场资金结构有何差异?】东北证券金融工程择时周报20200802...
  9. JMH(java代码的微基准测试)入门和汇总
  10. RANSAC算法理解
  11. 电脑wincc服务器配置文件,WinCC客户端与冗余服务器配置步骤
  12. 2022N1叉车司机题库及在线模拟考试
  13. 【OpenGL】笔记二十七、几何着色器
  14. SD卡变成RAW格式怎么办?SD卡RAW格式的解决办法
  15. Scratch课程设计(四)
  16. 凯云水利水电工程造价系统 (三) 材料单价 (2)
  17. Android之RemoteViews
  18. 线程的同步与互斥:互斥锁
  19. Python网络爬虫爬淘宝无法爬取问题的解决方法
  20. [从零学习汇编语言] - BX寄存器与loop指令

热门文章

  1. 一个需求价值评估的方法——靶图
  2. MATLAB-三维柱状图
  3. Java编程语言介绍
  4. 水果fl studio21最新中文注册版安装教程
  5. 计算机组成原理----有关数据通路
  6. oracle宿舍管理系统实训报告,宿舍管理系统实验报告..doc
  7. 360度全景摄像是什么?360度全景摄像有什么用?
  8. 计算机网络常见的协议之ARP协议
  9. 删除github上的一个仓库或者仓库里面的某个文件
  10. 12种文本数据采集方法