代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title></title>
</head>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<body>
<?php
$dsn="mysql:host=localhost;dbname=exam";
$db=new PDO($dsn,'root','');
$db->query('set names utf8');
$result=$db->query('select * from exam0');
$result->setFetchMode(PDO::FETCH_ASSOC);
?>
<div class="container">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title" align="center">考试查询</h3>
</div>
<div class="panel-body">
<table class="table table-striped" >
<fieldset>
<legend class="text-center">共有<?php echo $result->rowCount() ?>门课程可以考试,请根据各自班级准时去往各自考场</legend>
<thead>
<tr>
<th>考试科目</th>
<th>考试班级</th>
<th>考试时间</th>
<th>考试地点</th>
<th>监考老师</th>
</tr>
</thead>
</fieldset>
<tbody>
<form method='post' action="">
<div>
<input type="submit" style="float: right" value="搜索">
<span style="float: right"> </span>
<input type="text" style="float: right" name="selected">
</div>
</form>
<?php
if (isset($_POST['selected'])){
$mohu=$db->prepare ("select * from exam0 where course like ?");
$cour=$_POST['selected'];
$mohu->execute(array("%$cour%"));
$mohu->setFetchMode(PDO::FETCH_ASSOC);
while($row=$mohu->fetch()){
echo "
<tr>
<td>$row[course]</td>
<td>$row[class]</td>
<td>$row[time]</td>
<td>$row[place]</td>
<td>$row[teacher]</td>
</tr>
";
$name=$row['course'];
}
}
else{
while($row=$result->fetch()){
echo "
<tr>
<td>$row[course]</td>
<td>$row[class]</td>
<td>$row[time]</td>
<td>$row[place]</td>
<td>$row[teacher]</td>
</tr>
";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。