数据库课程设计 PHP web实现
纪念一下自己写的东西.. 都说很垃圾就是了
直接用XAMPP做的 菜鸟网上学的PHP和HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>学生信息</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<center>
<br><br>
<h2>学生信息管理</h2>
<a href="myindex.php">浏览学生</a>
<a href="login.php">增删学生</a>
<hr>
<br><br><br><br><br>
<form action="search.php" method="post">
<input type="text" name = "fname"><br>
<input type="radio" name = "vehicle" value="name">姓名<br>
<input type="radio" name = "vehicle" value="num" checked="checked">学号<br>
<input type="radio" name = "vehicle" value="course" checked="checked">课程<br>
<input type="submit" value = "搜索">
</form>
</center>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
test1
<!DOCTYPE html>
<head>
<meta charset = "UTF-8">
<title>学生信息管理</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<center>
<h3>浏览学生信息<h3>
<table width = "800" border = "1">
<tr>
<th>学号</th>
<th>姓名</th>
<th>课程1</th>
<th>课程2</th>
<th>课程3</th>
<th>课程4</th>
<th>课程5</th>
</tr>
<?php
$dbhost = "localhost:3306";
$dbuser = "root";
$dbpass = ""; $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(!$conn)
{
die('Could not connect: ' . mysqli_error());
}
mysqli_query($conn , "set names utf8");
mysqli_select_db($conn, 'demo'); $sql = "SELECT * FROM stu";
$retval = mysqli_query($conn, $sql); while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "<td>{$row['课程1']} </td> ";
echo "<td>{$row['课程2']} </td> ";
echo "<td>{$row['课程3']} </td> ";
echo "<td>{$row['课程4']} </td> ";
echo "<td>{$row['课程5']} </td> ";
echo "</tr>";
} ?>
</table>
</center>
<h3>
<a href="test1.php">返回首页</a>
</h3>
</body>
</html>
myindex
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>课程查询</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<center>
<?php
$dbhost = "localhost:3306";
$dbuser = "root";
$dbpass = ""; $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(!$conn)
{
die('Could not connect: ' . mysqli_error());
}
mysqli_query($conn , "set names utf8");
mysqli_select_db($conn, 'demo'); $sqlll = $_POST["fname"];
$sqlcheck = $_POST["vehicle"]; echo "<br><br><br><br><br><br><br><br><br><br><br><br><br>";
if($sqlcheck === 'course')
{
echo "<table width = '400' border = '2'>";
echo "<tr>";
echo "<th>学号</th>";
echo "<th>姓名</th>";
echo "</tr>"; $sql = "SELECT `学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5` FROM `stu` WHERE `课程1` LIKE '$sqlll'";
$retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "</tr>";
} $sql = "SELECT `学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5` FROM `stu` WHERE `课程2` LIKE '$sqlll'";
$retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "</tr>";
} $sql = "SELECT `学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5` FROM `stu` WHERE `课程3` LIKE '$sqlll'";
$retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "</tr>";
} $sql = "SELECT `学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5` FROM `stu` WHERE `课程4` LIKE '$sqlll'";
$retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "</tr>";
} $sql = "SELECT `学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5` FROM `stu` WHERE `课程5` LIKE '$sqlll'";
$retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "</tr>";
}
echo "</table>";
}
else {
if($sqlcheck === 'name') {$sql = "SELECT * FROM `stu` WHERE `姓名` LIKE '$sqlll'";}
else {$sql = "SELECT * FROM `stu` WHERE `学号` LIKE '$sqlll'";} echo "<table width = '800' border = '1'>";
echo "<tr>";
echo "<th>学号</th>";
echo "<th>姓名</th>";
echo "<th>课程1</th>";
echo "<th>课程2</th>";
echo "<th>课程3</th>";
echo "<th>课程4</th>";
echo "<th>课程5</th>"; $retval = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo "<tr>";
echo "<td>{$row['学号']}</td> ";
echo "<td>{$row['姓名']}</td> ";
echo "<td>{$row['课程1']} </td> ";
echo "<td>{$row['课程2']} </td> ";
echo "<td>{$row['课程3']} </td> ";
echo "<td>{$row['课程4']} </td> ";
echo "<td>{$row['课程5']} </td> ";
echo "</tr>";
}
echo "</table>";
} ?>
</center>
<h3>
<a href="test1.php">返回首页</a>
</h3>
</body>
</html>
search
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加学生</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<?php
$use = $_POST["user"];
$pass = $_POST["password"]; echo "<br><br><br><br><br><br><br><br><br><br>";
echo "<center>";
if($use === "admin" && $pass == "123")
{
echo "<h1>Welcome, lwq</h1>";
echo "<br>"; echo "<form action='addaction.php' method='post'>";
echo "<input type='text' name = 's1'>学号<br>";
echo "<input type='text' name = 's2'>姓名<br>";
echo "<input type='text' name = 's3'>课程1<br>";
echo "<input type='text' name = 's4'>课程2<br>";
echo "<input type='text' name = 's5'>课程3<br>";
echo "<input type='text' name = 's6'>课程4<br>";
echo "<input type='text' name = 's7'>课程5<br>";
echo "<input type='submit' value = '添加'>";
echo "</form>"; echo "<br><br><br>";
echo "<form action='delete.php' method='post'>";
echo "<input type='text' name = 'd1'>学号<br>";
echo "<input type='text' name = 'd2'>姓名<br>";
echo "<input type='submit' value = '删除'>";
echo "</form>";
}
else {
echo "sorry, assess denied!!<br>";
header("Location:test1.php");
}
echo "</center>";
?> <h3>
<a href="test1.php">返回首页</a>
</h3>
</body>
</html>
add
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登陆</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<br><br><br><br><br><br><br><br><br><br>
<center>
<form action="add.php" method="post">
用户: <input type="text" name="user"><br>
密码: <input type="password" name="password">
<input type="submit" value = "登陆">
</form>
</center>
<h3>
<a href="test1.php">返回首页</a>
</h3>
</body>
</html>
login
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加学生</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<br><br><br><br><br><br><br><br><br><br>
<center>
<?php
$r1 = $_POST["s1"];
$r2 = $_POST["s2"];
$r3 = $_POST["s3"];
$r4 = $_POST["s4"];
$r5 = $_POST["s5"];
$r6 = $_POST["s6"];
$r7 = $_POST["s7"]; $dbhost = "localhost:3306";
$dbuser = "root";
$dbpass = ""; $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(!$conn)
{
die('Could not connect: ' . mysqli_error());
}
mysqli_query($conn , "set names utf8");
mysqli_select_db($conn, 'demo'); $sql = "INSERT INTO `stu` (`学号`, `姓名`, `课程1`, `课程2`, `课程3`, `课程4`, `课程5`) VALUES ('$r1', '$r2', '$r3', '$r4', '$r5', '$r6', '$r7');";
$retval = mysqli_query($conn, $sql);
echo "添加成功";
?>
</center>
<h3>
<a href="add.php">继续添加</a>
<a href="test1.php">返回首页</a>
</body>
</html>
addaction
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>学生信息</title>
</head> <style>
body {
background: rgba(12, 100, 129, 1) url('https://images2018.cnblogs.com/blog/1393985/201806/1393985-20180613124043614-112674236.jpg') fixed no-repeat;
background-position: 50% 5%;
background-size: cover;
}
</style> <body>
<br><br><br><br><br><br><br><br><br><br>
<center>
<?php
$t1 = $_POST["d1"];
$t2 = $_POST["d2"]; $dbhost = "localhost:3306";
$dbuser = "root";
$dbpass = ""; $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(!$conn)
{
die('Could not connect: ' . mysqli_error());
}
mysqli_query($conn , "set names utf8");
mysqli_select_db($conn, 'demo'); $sql = "DELETE FROM `stu` WHERE 学号 = '$t1'";
$retval = mysqli_query($conn, $sql);
$sql = "DELETE FROM `stu` WHERE 姓名 = '$t2'";
$retval = mysqli_query($conn, $sql);
echo "删除成功";
?>
</center>
<h3>
<a href="test1.php">返回首页</a>
</body>
</html>
delete
数据库课程设计 PHP web实现的更多相关文章
- 数据库课程设计:SQL Server + Express + node.js + ejs 论坛管理系统
前言 这是一篇对数据库课程设计的总结,这不是教程也不是指导,只是我的经验之谈,其中可能有许多错误,请小心,不要被误导.祝愿你看了这篇文章后能做出更好的设计. 我对web开发并不熟悉,而我们的课程设计只 ...
- 服装销售系统数据库课程设计(MVC)
<数据库课程设计> 名称:Jia服装销售网站 姓名:陈文哲 学号:…… 班级:11软件工程 指导老师:索剑 目录 目录 1 需求分析 3 一:销售部门机构情况 3 二:销售部门的业务活动情 ...
- AlanShan数据库课程设计报告
目 录 1.绪论.... 2 1.1前言... 2 1.2社会背景... 2 1.3超市背景... 3 2.系统可行性研究.... 4 2.1 技术可行性研究... 4 2.2 经济可行性研究. ...
- Java课程设计之——Web前端
主要使用的技术 Javascript/JQuery html css Jsp 前期调查 能看到的网页大致可以分为两个部分,一个是搜索的首页index.html,一个是搜索结果页/s index.htm ...
- Java课程设计+购物车WEB页面
1. 团队名称(keke) 徐婉萍:网络1511 201521123006 2. 项目git地址 3. 项目git提交记录截图 4. 项目功能架构图与主要功能流程图 项目功能架构图 项目主要功能流程图 ...
- JAVA面向对象编程课程设计——web版斗地主
一.团队课程设计博客链接 JAVA面向对象编程课程设计--网络版单机斗地主 二.个人负责模块或任务说明 实体类的设计 斗地主规则的实现 人机自动出牌的算法 实现数据库的DAO模式 三.自己的代码提交记 ...
- C语言连接MySQL数据库(课程设计总结)
刚结束课程设计,也预示着假期立即就要到来了.本次课程设计并不算难,无非就是让做一个XXX系统,实现用户的注冊.登录.菜单管理.超级用户等等一些功能,到如今为止已经做过好几个了,所以基本流程都熟悉了! ...
- springmvc 项目完整示例01 需求与数据库表设计 简单的springmvc应用实例 web项目
一个简单的用户登录系统 用户有账号密码,登录ip,登录时间 打开登录页面,输入用户名密码 登录日志,可以记录登陆的时间,登陆的ip 成功登陆了的话,就更新用户的最后登入时间和ip,同时记录一条登录记录 ...
- Web前端课程设计——个人主页
大三上学期期末总结,嗯,没错,是上学期,写在新学期开始hhh. 上学期学了一门HTML5+CSS3的课程,也叫Web前端技术,期末的课程设计是写一个个人主页,能够在浏览器中打开的静态网页.通过一学期的 ...
随机推荐
- C++中的new用法总结
前段时间复习面试的时候,看到这个问题经常有问到,我这个小白就看了些博客和书,总结一下. new可以说是个一个关键字,也可以说是一个运算符,并且可以被重载. 1.new operator 这个就是平时最 ...
- Android6.0 危险权限和普通权限
Normal Permissions如下 ACCESS_LOCATION_EXTRA_COMMANDS ACCESS_NETWORK_STATE ACCESS_NOTIFICATION_POLICY ...
- Moctf--没时间解释了
记录一道简单的题目. 打开后就张这个样子,,然后看到url为index2.php---->所以我们把它改为index.php(用burp抓包才行,这是一个302跳转). 看到它提示我们要uplo ...
- lightoj 1025【区间DP】
题意: 给出一个word,求有多少种方法你从这个word清除一些字符而达到一个回文串. 思路: 区间问题,还是区间DP: 我判断小的区间有多少,然后往外扩大一点. dp[i,j]就代表从i到j的方案数 ...
- pip 国内安装镜像源
转自: https://blog.csdn.net/xuezhangjun0121/article/details/81664260 pip国内的一些镜像 阿里云 http://mirrors.a ...
- Hexo搭建博客教程(3) - 远程部署到GitHub Pages
本章讲的是如何将本地的个人项目远程部署到 GitHub Pages,涉及到GitHub的项目仓库.Git的使用,以及Hexo的远程部署等. 1. 安装 hexo-deployer-git 插件 想要将 ...
- Oracle之Char VarChar VarChar2
Oracle之Char VarChar VarChar2 在Oracle数据库中,字符类型有Char.VarChar和VarChar2三种类型,但不大清楚各自区别在哪儿,平时基本上就是用VarChar ...
- ashx 中获取 session获取信息
1.在应用程序中获取session,System.Web.HttpContext.Current.Session: 2.命名空间如下:IRequiresSessionState 调用方法 public ...
- 不通过ecplise,只通过文件目录 创建最简单的JSP文件
手动创建最简单的JSP 文件 1.在Tomcat 6.0的安装目录的webapps目录下新建一个目录,起名叫myapp. 2.在myapp目录下新建一个目录WEB-INF,注意,目录名称是区分大小 ...
- CentOS 7.2最小化安装没有ifconfig命令,使用yum provides ifconfig找不到相关的包
[root@sishen yum.repos.d]# yum provides ifconfig Loaded plugins: fastestmirror Loading mirror speeds ...