代码拉取完成,页面将自动刷新
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>学生选课系统主页</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<script src="js/jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/header.css" />
<link rel="stylesheet" type="text/css" href="css/footer.css" />
<script type="text/javascript">
show=function(li){
var a=li.getElementsByTagName("ul")[0];
a.style.display="block";
}
hide=function(li){
var a=li.getElementsByTagName("ul")[0];
a.style.display="none";
}
</script>
<style type="text/css">
.img-responsive {
display: block;
max-height: 350px;
max-width: 1000px;
}
</style>
</head>
<body>
<?php
include("header.php");
include ("functions.php");
include_once ("./conn.php");
?>
<section class="sec01">
<h1 style="margin-top: 5px;">教务系统</h1>
<hr/>
</section>
<section class="sec02"><!-- 轮播图片 -->
<div id="demo" class="carousel slide" data-ride="carousel">
<?php
$sql="select * from adpic where sequence>0 order by sequence desc";
//sequence是排序权重 值越大 轮播图排序越靠前
$result = mysqli_query($link,$sql);
if (!$result) {
//输出错误信息
printf("Error: %s\n", mysqli_error($link));
exit();
}else{
//读取数据库的adpic表 打印轮播图内容
echo "<ul class=\"carousel-indicators\">";
echo "<li data-target=\"#demo\" data-slide-to=\"0\" class=\"active\"></li>";
for($i=1;$i<mysqli_num_rows($result);$i++)
{
echo "<li data-target=\"#demo\" data-slide-to=\"{$i}\"></li>";
}
echo "</ul>";
$flag=true;
echo "<div class=\"carousel-inner sec02a\">";
while($row=mysqli_fetch_assoc($result))
{
if($flag)
{
//首张轮播图获取热点
$flag=!$flag;
echo"<div class=\"carousel-item active\"><a href=\"{$row['tourl']}\"><img class='img-responsive' src=\"adpic/pics/{$row['picnameinfiles']}\"></a></div>";
}else{
echo"<div class=\"carousel-item\"><a href=\"{$row['tourl']}\"><img class='img-responsive' src=\"adpic/pics/{$row['picnameinfiles']}\"></a></div>";
//$row['tourl'] 轮播图点击后跳转的链接
//$row['picnameinfiles'] 轮播图实际存储时使用的文件名
}
}
echo "</div>";
}
?>
<!-- 左右切换按钮 -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</section>
<?php
$kindname=array("null","热门专业课程","热门通识课程","热门选修课程");
for($kind=1;$kind<=3;$kind++) {
?>
<section class="sec01" style="position: relative;">
<h1 style="margin-top: 20px;"><?php echo $kindname[$kind]; ?></h1>
<a class="morecorse" href="Courselib.php">查看更多>></a>
<hr/>
<section class="news-list" id="text">
<?php
$selstr = "picnameinfile,teachername,nowpeople,numpeople,coursename,introducetext,c.introduceid,courseid";
$result = $link->query("SELECT COUNT(*)
FROM course as c,introduce as i,teacher as t
where c.delete='0' and c.numpeople!=c.nowpeople and c.introduceid=i.introduceid and t.teacherid=c.teacherid and kind='$kind'");
list($row_num) = $result->fetch_row(); /// $row_num即为记录数
$sql = "select $selstr
from course as c,introduce as i,teacher as t
where c.delete='0' and c.numpeople!=c.nowpeople and c.introduceid=i.introduceid and t.teacherid=c.teacherid and kind='$kind'
order by courseid desc limit 3";//limit 0,3 ?
$result = mysqli_query($link, $sql);
if (!$result) {
printf("Error: %s\n", mysqli_error($link));
exit();
} else {
$results = array();
while ($row = mysqli_fetch_assoc($result)) {
//$selstr="picnameinfile,teachername,nowpeople,numpeople,coursename,introducetext,introduceid,courseid"
$people = $row['nowpeople'] . "/" . $row['numpeople'];
$introducetext = Trim_tit($row['introducetext'], 34);
echo " <article class=\"news-item box\" data-category=\"Cat1\">
<figure class=\"snip1208\">
<img src=\"courselib/pic/{$row['picnameinfile']}\" alt=\"sample66\"/>
<div class=\"date\"><span class=\"day\">{$row['teachername']}</span><span class=\"month\">{$people}</span></div>
<figcaption>
<h3>{$row['coursename']}</h3>
<p>
{$introducetext}
</p>
<button>查看详情 》》</button>
</figcaption><a target=\"_blank\" href=\"Courseintroduce.php?courseid={$row['courseid']}&src={$row['introduceid']}\"></a>
</figure>
</article>";
}
}
?>
<script src="js/Courselib-sec01.js" type="text/javascript"></script>
</section>
</section>
<?php
}
$link->close();
//关闭数据库连接
include ("footer.html");
?>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。