数据库开发实验报告

数据库开发实验报告关于航班信息系统设计及实现的报告一 选题本实验选用国内某机场一天的航班数据作为基础数据 并在此基础上对数据进行增 删 查 改 前端使用 HTML 语言 JavaScript CSS 语言 后端使用 PHP 语言数据库使用 MySQ

大家好,欢迎来到IT知识分享网。

关于航班信息系统设计及实现的报告

一、选题

  1. 本实验选用国内某机场一天的航班数据作为基础数据,并在此基础上对数据进行增、删、查、改;
  2. 前端使用HTML语言、JavaScript、CSS语言,后端使用PHP语言
  3. 数据库使用MySQL

二、DB设计

  1. 数据库名db_work
  2. 使用单表操作
  3. 表名flights
  4. flights包含columns有:id,flight,source,destination,transit,arrival_time,terminal,status共8列
  5. 建立数据库即表的命令如下
    DROP DATABASE IF EXISTS db_work; CREATE database db_work; USE db_work; SET names utf8; CREATE TABLE flights ( id int(3) NOT NULL AUTO_INCREMENT, flight char(6) NOT NULL, source tinytext NOT NULL, destination tinytext NOT NULL, transit tinytext, arrival_time time not null, terminal char(2) not null, status tinytext not null, PRIMARY KEY (id) )default charset=utf8; INSERT INTO flights (flight,source,destination,transit,arrival_time,terminal,status) values ('8L9616','济南','成都','','0:00','T2','计划00:00到达'); INSERT INTO flights (flight,source,destination,transit,arrival_time,terminal,status) values ('MU5415','上海虹桥','成都','','0:05','T2','已于00:09到达'); INSERT INTO flights (flight,source,destination,transit,arrival_time,terminal,status) values ('3U5016','上海虹桥','成都','','0:05','T2','已于00:09到达'); 

三、实现

  1. 增加数据的功能由insert.html,insert.php两个文件共同实现;
  2. 删除数据的功能由delete.html,delete1.php,delete.2.php共同实现;
  3. 查询数据的功能由select.html,select.php共同实现;
  4. 修改数据的功能由alter.html,alter1.php,alter2.php,alter3.php共同实现
  5. 首页由index.php呈现
  6. 数据库连接由sql-connect.php实现
index.php
<!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> <style> a{ 
    text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);} a:link{ 
    color:#00FFFF;}/*未访问的颜色 蓝色*/ a:hover{ 
    color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
    color:#00FFFF;}/*访问过的颜色 蓝色*/ a:active{ 
    color:#FF00FF;}/*选定的代码 紫色*/ body{ 
     background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> </head> <body> <div style="font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);" align="center">请选择您需要的服务</div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="insert.html" align="center" >计划航班信息插入</a></p> <p><a href="select.html" align="center">现行航班状态查询</a></p> <p><a href="alter.html" align="center">航班相关信息修改</a></p> <p><a href="delete.html" align="center">已完成任务航班信息删除</a></p> </div> </body> </html> 
sql-connect.php
<?php $dbhost='localhost'; $dbuser=''; $dbpass=''; $db='db_work'; @error_reporting(0); @$con = mysqli_connect($dbhost,$dbuser,$dbpass,$db); // Check connection mysqli_query($con,"set character set 'utf8'");//读库  mysqli_query($con,"set names 'utf8'");//写库  if (!$con) { 
    echo "Failed to connect to MySQL: " . mysqli_error($con); } ?> 

增加数据

insert.html
<html> <head> <title>增添航班数据</title> <meta charset="utf-8"> <style type = "text/css"> a{ 
    text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);} a:link{ 
    color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
    color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
    color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
    color:#FF00FF;}/*选定的代码 紫色*/ body{ 
     background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> </head> <body> <div style="font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);" align="center">请填写表单以添加数据</div> <div style="border:1px;border-color: #00bee7" align="center"> <form action="insert.php" method="post" style="margin:35px auto;padding:30px;box-shadow:1px 1px 2px 1px #aaaaaa;  border-radius: 3px;width:450px;"> <ul> <li> 航班号:<input type="text" name="flight" required="required" maxlength="6" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入6位航班号"> </li> <li> 出发地:<input type="text" name="source" required="required" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入出发地"> </li> <li> 目的地:<input type="text" name="destination" required="required" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入目的地"> </li> <li> 经停站:<input type="text" name="transit" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入经停站"> </li> <li> 预到时:<input type="text" name="arrival_time" maxlength="8" required="required" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入预计到达时间"> </li> <li> 航站楼:<input type="text" name="terminal" required="required" maxlength="2" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入2位字符航站楼"> </li> <li> <br> <input type="radio" name="status" value="已于" checked><strong>已于</strong> <input type="radio" name="status" value="计划"><strong>计划</strong><br> 现状态:<input type="text" name="status_time" required="required" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入当前状态(输入时间),已于xx:xx到达或计划xx:xx到达"><br>到达 </li> </ul> <input type="submit" value="提交" style ="height : 36px;border:1px;background-color:#005ce7;color:#fff;width:72px;border-radius: 3px;"> </form> </div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="index.php" align="center" >返回服务选择页面</a></p> </div> </body> </html> 
insert.php
<!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=utf8" /> <title>查询结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgba(0,0,0,1);} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#39fafa;" align="center">插入结果如下</div> <div style="border:1px;" align="center"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); $flight =trim($_POST['flight']); $source =trim($_POST['source']); $destination=trim($_POST['destination']); $transit =$_POST['transit']!=NULL?trim($_POST['transit']):''; $arrival_time =trim($_POST['arrival_time']); $terminal=trim($_POST['terminal']); $status=$_POST['status'].$_POST['status_time'].'到达'; if(!$con){ 
    ?> <script type="text/javascript"> alert("数据库连接失败"); window.location.href="select.html"; </script> <?php } //$sql="select * from flights"; $sql = "insert into flights(flight,source,destination,transit,arrival_time,terminal,status)values ('$flight' ,'$source','$destination' ,'$transit' ,'$arrival_time' ,'$terminal','$status')"; //echo $sql; $info = mysqli_query($con,$sql); if($info){ 
    ?> <script type="text/javascript"> alert("插入成功"); </script> <?php echo "<tr><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$flight."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$source."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$destination."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$transit."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$arrival_time."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$terminal."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$status."</td></tr>"; } else{ 
    ?> <script type="text/javascript"> alert("插入失败,请检查输入"); window.location.href="select.html"; </script> <?php } ?> </table> </center> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="select.html" align="center" style="font-size:20px;font-family:微软雅黑;color:#39fafa;">返回查询页面</a></p> </div> </body> </html> 

删除数据

delete.html
<!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> <style type = "text/css"> a{ 
    text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);} a:link{ 
    color:#3786fd;}/*未访问的颜色 蓝色*/ a:hover{ 
    color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
    color:#39fafa;}/*访问过的颜色 蓝色*/ a:active{ 
    color:#FF00FF;}/*选定的代码 紫色*/ body{ 
     background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> </head> <body> <div style="font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);" align="center"> <p>筛选</p> </div> <form action="delete1.php" method="post" style="margin: 35px auto;padding:30px;box-shadow: 1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:380px;"> <input type="text" name="flight" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="航班号"> <input type="text" name="source" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="出发点"> <input type="text" name="destination" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="目的地"> <input type="text" name="transit" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="经停站"> <input type="text" name="arrival_time" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="预计几点之后到达"> <select name="status"> <option value="到达" selected>不限</option> <option value="已于">已到达</option> <option value="计划">未到达</option> </select> <input type="submit" value="查询" style ="height : 36px;border:1px;background-color:#0334d3;color:#fff;width:72px;border-radius: 3px;"> </form> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="index.php" align="center" >返回服务选择页面</a></p> </div> </body> </html> 
delete1.php
<!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=utf8" /> <title>查询结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:#ffe600;} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#ffe600;" align="center">查询的结果如下</div> <div style="border:1px;border-color: #00bee7" align="center" > <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="select.html" align="center" >返回查询页面</a></p> </div > <div style="padding:10px;"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);"> <input type="button" name = "selectall" value = "全选" onclick="selectall()"/><input type="button" name = "selectnone" value = "全不选" onclick="selectnone()"/> <input type="button" name = "selectback" value = "反选" onclick="selectback()"/> </td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">id</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); $flight = $_POST['flight']!=NULL?trim($_POST['flight']):"1'-'1"; $source = $_POST['source']!=NULL?trim($_POST['source']):"1'-'1"; $destination=$_POST['destination']!=NULL?trim($_POST['destination']):"1'-'1"; $transit = $_POST['transit']!=NULL?trim($_POST['transit']):"1'-'1"; $arrival_time = $_POST['arrival_time']!=NULL?trim($_POST['arrival_time']):"1'-'1"; $status=$_POST['status']; if(!$con){ 
    ?> <script type="text/javascript"> alert("数据库连接失败"); window.location.href="select.html"; </script> <?php } //$sql="select * from flights"; $sql = "select * from flights where flight='$flight' and source='$source' and destination='$destination' and transit='$transit' and arrival_time>='$arrival_time' and status like '%$status%';"; //echo $sql; $info = mysqli_query($con,$sql); $num = mysqli_num_rows($info); if($num){ 
    ?> <form action="delete2.php" method="post" style="margin: 35px auto;padding:30px;box-shadow: 1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:380px;"> <?php while($row = mysqli_fetch_row($info)){ 
    //显示所有信息 echo "<tr><td><input type='checkbox' name='delete[]' value='".$row[0]."'></td><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[0]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[1]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[2]."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:color:rgba(0,0,0,1);'>".$row[3]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[4]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[5]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[6]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[7]."</td></tr>"; } ?> <script type ="text/javascript"> function selectall() { 
    var sports = document.getElementsByName("delete[]"); for (i=0;i<sports.length ;i++ ) { 
    var sportname =sports[i]; sportname.checked= true; } } function selectnone() { 
    var sports = document.getElementsByName("delete[]"); for (i=0;i<sports.length ;i++ ) { 
    var sportname =sports[i]; sportname.checked= false; } } function selectback() { 
    var sports = document.getElementsByName("delete[]"); for (a=0;a<sports.length ;a++ ) { 
    var sportname1 =sports[a]; if(sportname1.checked==false) { 
    sportname1.checked= true; }else{ 
    sportname1.checked=false } } } </script> <button type="submit" name="submit" style ="height : 50px;border:1px;background-color:#0334d3;color:#fff;width:80px;border-radius: 3px;">选择完毕<br>提交删除</button> <?php } else{ 
    ?> <script type="text/javascript"> alert("查询无果"); window.location.href="select.html"; </script> <?php } ?> </table> </center> </div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="select.html" align="center" >返回查询页面</a></p> </div> </body> </html> 
delete2.php
<?php include("sql-connect.php"); if(isset($_POST['submit'])) { 
    if(isset($_POST['delete']))$del=$_POST['delete']; if(count($del)) { 
    foreach($del as $value) { 
    $sql="delete from flights where id=$value"; //echo $sql."<br>"; $info=mysqli_query($con,$sql); if($info){ 
    //echo $info."删除成功<br>"; ?> <script type="text/javascript"> alert("删除成功"); window.location.href="delete.html"; </script> <?php } else { 
    //echo $info."删除成功<br>"; ?> <script type="text/javascript"> alert("删除失败"); window.location.href="delete.html"; </script> <?php } } } } else echo '页面错误'; 
查询数据
select.html
<!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> <style type = "text/css"> a{ 
    text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);} a:link{ 
    color:#3786fd;}/*未访问的颜色 蓝色*/ a:hover{ 
    color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
    color:#39fafa;}/*访问过的颜色 蓝色*/ a:active{ 
    color:#FF00FF;}/*选定的代码 紫色*/ body{ 
     background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> </head> <body> <div style="font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);" align="center"> <p>筛选</p> </div> <form action="select.php" method="post" style="margin: 35px auto;padding:30px;box-shadow: 1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:380px;"> <input type="text" name="flight" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="航班号"> <input type="text" name="source" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="出发点"> <input type="text" name="destination" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="目的地"> <input type="text" name="transit" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="经停站"> <input type="text" name="arrival_time" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="预计几点之后到达"> <select name="status"> <option value="到达" selected>不限</option> <option value="已于">已到达</option> <option value="计划">未到达</option> </select> <input type="submit" value="查询" style ="height : 36px;border:1px;background-color:#0334d3;color:#fff;width:72px;border-radius: 3px;"> </form> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="index.php" align="center" >返回服务选择页面</a></p> </div> </body> </html> 
select.php
<!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=utf8" /> <title>查询结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:#ffe600;} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#ffe600;" align="center">查询的结果如下</div> <div style="border:1px;border-color: #00bee7" align="center" > <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="select.html" align="center" >返回查询页面</a></p> </div > <div style="padding:10px;"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">id</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); $flight = $_POST['flight']!=NULL?trim($_POST['flight']):"1'-'1"; $source = $_POST['source']!=NULL?trim($_POST['source']):"1'-'1"; $destination=$_POST['destination']!=NULL?trim($_POST['destination']):"1'-'1"; $transit = $_POST['transit']!=NULL?trim($_POST['transit']):"1'-'1"; $arrival_time = $_POST['arrival_time']!=NULL?trim($_POST['arrival_time']):"1'-'1"; $status=$_POST['status']; if(!$con){ 
    ?> <script type="text/javascript"> alert("数据库连接失败"); window.location.href="select.html"; </script> <?php } //$sql="select * from flights"; $sql = "select * from flights where flight='$flight' and source='$source' and destination='$destination' and transit='$transit' and arrival_time>='$arrival_time' and status like '%$status%';"; //echo $sql; $info = mysqli_query($con,$sql); $num = mysqli_num_rows($info); if($num){ 
    //查询成功 while($row = mysqli_fetch_row($info)){ 
    //显示所有信息 echo "<tr><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[0]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[1]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[2]."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:color:rgba(0,0,0,1);'>".$row[3]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[4]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[5]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[6]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[7]."</td></tr>"; } } else{ 
    ?> <script type="text/javascript"> alert("查询无果"); window.location.href="select.html"; </script> <?php } ?> </table> </center> </div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="select.html" align="center" >返回查询页面</a></p> </div> </body> </html> 

修改数据

alter.html
<!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> <style type = "text/css"> a{ 
    text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);} a:link{ 
    color:#3786fd;}/*未访问的颜色 蓝色*/ a:hover{ 
    color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
    color:#39fafa;}/*访问过的颜色 蓝色*/ a:active{ 
    color:#FF00FF;}/*选定的代码 紫色*/ body{ 
     background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> </head> <body> <div style="font-size:25px;font-family:微软雅黑;color:rgb(98,94,91);" align="center"> <p>筛选</p> </div> <form action="alter.php" method="post" style="margin: 35px auto;padding:30px;box-shadow: 1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:380px;"> <input type="text" name="flight" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="航班号"> <input type="text" name="source" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="出发点"> <input type="text" name="destination" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="目的地"> <input type="text" name="transit" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="经停站"> <input type="text" name="arrival_time" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:240px;" placeholder="预计几点之后到达"> <select name="status"> <option value="到达" selected>不限</option> <option value="已于">已到达</option> <option value="计划">未到达</option> </select> <input type="submit" value="查询" style ="height : 36px;border:1px;background-color:#0334d3;color:#fff;width:72px;border-radius: 3px;"> </form> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="index.php" align="center" >返回服务选择页面</a></p> </div> </body> </html> 
alter1.php
<!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=utf8" /> <title>查询结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:#ffe600;} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#ffe600;" align="center">查询的结果如下</div> <div style="border:1px;border-color: #00bee7" align="center" > <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="alter.html" align="center" >返回查询页面</a></p> </div > <div style="padding:10px;"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">选择</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">id</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); $flight = $_POST['flight']!=NULL?trim($_POST['flight']):"1'-'1"; $source = $_POST['source']!=NULL?trim($_POST['source']):"1'-'1"; $destination=$_POST['destination']!=NULL?trim($_POST['destination']):"1'-'1"; $transit = $_POST['transit']!=NULL?trim($_POST['transit']):"1'-'1"; $arrival_time = $_POST['arrival_time']!=NULL?trim($_POST['arrival_time']):"1'-'1"; $status=$_POST['status']; if(!$con){ 
    ?> <script type="text/javascript"> alert("数据库连接失败"); window.location.href="select.html"; </script> <?php } //$sql="select * from flights"; $sql = "select * from flights where flight='$flight' and source='$source' and destination='$destination' and transit='$transit' and arrival_time>='$arrival_time' and status like '%$status%';"; //echo $sql; $info = mysqli_query($con,$sql); $num = mysqli_num_rows($info); if($num){ 
    ?> <form action="alter2.php" method="post" style="margin: 35px auto;padding:30px;box-shadow: 1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:380px;"> <?php while($row = mysqli_fetch_row($info)){ 
    //显示所有信息 echo "<tr><td><input type='radio' name='alter' value='".$row[0]."'></td><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[0]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[1]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[2]."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:color:rgba(0,0,0,1);'>".$row[3]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[4]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[5]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[6]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[7]."</td></tr>"; } ?> <button type="submit" name="submit" style ="height : 50px;border:1px;background-color:#0334d3;color:#fff;width:80px;border-radius: 3px;">选择完毕<br>提交修改</button> </form> <?php } else{ 
    ?> <script type="text/javascript"> alert("查询无果"); window.location.href="alter.html"; </script> <?php } ?> </table> </center> </div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="alter.html" align="center" >返回查询页面</a></p> </div> </body> </html> 
alter2.php
<!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=utf8" /> <title>查询结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:#ffe600;} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#ffe600;" align="center">查询的结果如下</div> <div style="border:1px;border-color: #00bee7" align="center" > <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="alter.html" align="center" >返回查询页面</a></p> </div > <div style="padding:10px;"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">id</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); if(isset($_POST['submit'])) { 
    if(isset($_POST['alter']))$alter=$_POST['alter']; echo var_dump($alter); if(count($alter)==1) { 
    $sql="select * from flights where id=$alter"; echo $sql."<br>"; $info=mysqli_query($con,$sql); if($info){ 
    //echo $info."删除成功<br>"; $num = mysqli_num_rows($info); echo $num; if($num){ 
    //查询成功 $row = mysqli_fetch_row($info); //显示所有信息 echo "<tr><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[0]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[1]."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[2]."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:color:rgba(0,0,0,1);'>".$row[3]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[4]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[5]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[6]."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$row[7]."</td></tr>"; ?> <form action="alter3.php" method="post" style="margin:35px auto;padding:30px;box-shadow:1px 1px 2px 1px #aaaaaa;border-radius: 3px;width:450px;"> <input type="text" name="id_1" value="<?php echo $row[0];?>" style = "display:none"> <input type="text" name="old_status" value="<?php echo $row[7];?>" style = "display:none"> <tr> <td><input type="text" name="flight_1" value="<?php echo $row[1];?>" maxlength="6" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入6位航班号"></td> <td><input type="text" name="source_1" value="<?php echo $row[2];?>" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入出发地"></td> <td><input type="text" name="destination_1" value="<?php echo $row[3];?>" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入目的地"></td> <td><input type="text" name="transit_1" value="<?php echo $row[4];?>" maxlength="20" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入经停站"></td> <td><input type="text" name="arrival_time_1" value="<?php echo $row[5];?>" value="<?php echo $row[1];?>" maxlength="8" required="required" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入预计到达时间"></td> <td><input type="text" name="terminal_1" value="<?php echo $row[6];?>" maxlength="2" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入2位字符航站楼"></td> <td> <input type="radio" name="status_1" value="已于" checked><strong>已于</strong> <input type="radio" name="status_1" value="计划"><strong>计划</strong><br> 现状态:<input type="text" name="status_time_1" required="required" style = "background-color: rgb(255,255,255) !important; border-radius: 3px;box-shadow: none; color: rgb(0, 0, 0);line-height: 26px;width:200px;" placeholder="请输入当前状态(输入时间),已于xx:xx到达或计划xx:xx到达"><br>到达 </td> </tr>; <input type="submit" value="提交" style ="height : 36px;border:1px;background-color:#005ce7;color:#fff;width:72px;border-radius: 3px;"> </form> <?php } else{ 
    ?> <script type="text/javascript"> alert("查询无果"); window.location.href="select.html"; </script> <?php } } else { 
    //echo $info."删除成功<br>"; ?> <script type="text/javascript"> alert("查询失败"); window.location.href="delete.html"; </script> <?php } } else echo '查询错误'; } else echo '页面错误'; ?> </table> </center> </div> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="alter.html" align="center" >返回查询页面</a></p> </div> </body> </html> 
alter3.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php session_start();?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> <title>修改结果显示界面</title> </head> <style type = "text/css"> a{ 
   text-decoration: none;font-size:25px;font-family:微软雅黑;color:rgba(0,0,0,1);} a:link{ 
   color:#005ce7;}/*未访问的颜色 蓝色*/ a:hover{ 
   color:#FF00FF;}/*鼠标放上去的颜色(没起作用) 紫色*/ a:visited{ 
   color:#1641cf;}/*访问过的颜色 蓝色*/ a:active{ 
   color:#FF00FF;}/*选定的代码 紫色*/ body{ 
    background-image: url(白凤.jpg); background-repeat:no-repeat; background-attachment: fixed; } </style> <body> <div style="font-size:25px;font-family:微软雅黑;color:#39fafa;" align="center">修改结果如下</div> <div style="border:1px;" align="center"> <center> <table style="border: solid 1px;border-color:#09F;background-color:white;opacity:0.7;" align ="center" width=60% > <tr > <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">id</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航班号</td> <td width=90px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">始发地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">目的地</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">经停站</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">预计到达时间</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">航站楼</td> <td width=60px style="font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);">当前状态</td> </tr> </div> <?php include('sql-connect.php'); $flight =trim($_POST['flight_1']); $source =trim($_POST['source_1']); $destination=trim($_POST['destination_1']); $transit =$_POST['transit_1']!=NULL?trim($_POST['transit_1']):''; $arrival_time =trim($_POST['arrival_time_1']); $terminal=trim($_POST['terminal_1']); $status=$_POST['status_1'].$_POST['status_time_1'].'到达'; //echo $status."<br>".$_POST['old_status'].'<br>'; //$status=($status===$_POST['old_status']?$status:$_POST['old_status']); $id=$_POST['id_1']; //echo $status.$id; if(!$con){ 
    ?> <script type="text/javascript"> alert("数据库连接失败"); window.location.href="select.html"; </script> <?php } //$sql="select * from flights"; $sql = "update flights set flight='$flight',source='$source',destination='$destination',transit='$transit',arrival_time='$arrival_time',terminal='$terminal',status='$status' where id =$id"; //echo $sql; $info = mysqli_query($con,$sql); if($info){ 
    ?> <script type="text/javascript"> alert("修改成功"); </script> <?php echo "<tr><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$id."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$flight."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$source."</td> <td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$destination."</td><td width=90px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$transit."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$arrival_time."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$terminal."</td><td width=60px style='font-size:20px;font-family:微软雅黑;color:rgba(0,0,0,1);'>".$status."</td></tr>"; } else{ 
    ?> <script type="text/javascript"> alert("修改失败,请检查输入"); //window.location.href="select.html"; </script> <?php } ?> </table> </center> <div style="height:100px;width:240px;margin:0px auto;" align="center"> <p><a href="alter.html" align="center" style="font-size:20px;font-family:微软雅黑;color:#39fafa;">返回查询页面</a></p> </div> </body> </html> 

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/107947.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信