?? stu_list_top_score.php
字號:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>EasyTeacher信息技術課堂教學助手(ItAssis)學生端-積分排行榜</title>
<link href="et.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
}
-->
</style></head>
<body>
<h3 align="center"><img src="images/task_paihangbang.jpg"></h3>
<table width="50%" border="1" align="center" cellspacing="0" bordercolor="#C4D2E2">
<tr >
<td>姓名</td>
<td>班級</td>
<td>積分</td>
</tr>
<?php
include "conn.inc.php";
include "config.inc.php";
$db=Connect_db($CFG_DB_ADDRESS,$CFG_DB_PORT,$CFG_DB_NAME,$CFG_DB_OWNER,$CFG_DB_PWD);
$limit=$CFG_TASK_SHOW_TOP_NUMS;
?>
<?php
for($i=$CFG_USER_START_GRADE;$i<=$CFG_USER_END_GRADE;$i++){
$sql="select * from stu where grade=$i and score>0 order by score desc,sid limit $limit";
$result=mysql_query($sql,$db) or die($sql."<br>".mysql_error());
if(mysql_num_rows($result)<=0) continue;
echo "<tr><td colspan=3 align=center bgcolor=#FFE3CE>{$i}年級前{$limit}名</td></tr>";
while($array=mysql_fetch_array($result)){
echo "<tr><td>{$array['sid']}</td>";
echo "<td>{$array['grade']}({$array['class']})</td>";
echo "<td>{$array['score']}</td>";
}
echo "</tr>";
}
$limit=$limit-1;
for($i=$CFG_USER_START_GRADE;$i<=$CFG_USER_END_GRADE;$i++){
for($j=1;$j<=$CFG_USER_MAX_CLASS;$j++){
$sql="
select score from stu
where score>0 and grade=$i and class=$j
order by score desc
limit $limit,1";
$result=mysql_query($sql,$db) or die($sql."<br>".mysql_error());
$array=mysql_fetch_array($result);
if(mysql_num_rows($result)<=0) continue;
$split_score=$array['score'];
$sql="
select * from stu
where score>=$split_score and grade=$i and class=$j
order by score desc";
$result=mysql_query($sql,$db) or die($sql."<br>".mysql_error());
if(mysql_num_rows($result)<=0) continue;
echo "<tr><td colspan=3 align=center bgcolor=#FFE3CE>{$i}($j)班前{$CFG_TASK_SHOW_TOP_NUMS}名 分段值:".$split_score."</td></tr>";
while($array=mysql_fetch_array($result)){
echo "<tr><td>{$array['sid']}</td>";
echo "<td>{$array['grade']}({$array['class']})</td>";
echo "<td>{$array['score']}</td>";
}
echo "</tr>";
}
}
?>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -