File: C:/xampp/htdocs/FograCT1/rankSTa23.php
<?php
//session_start();
?>
<?php
/*
All source code copyright and proprietary Melonfire, 2002. All content, brand names and trademarks copyright and proprietary Melonfire, 2002. All rights reserved. Copyright infringement is a violation of law.
This source code is provided with NO WARRANTY WHATSOEVER. It is produced and meant for illustrative purposes only, and is NOT recommended for use in production environments.
Read more articles like this one at http://www.melonfire.com/community/columns/trog/ and http://www.melonfire.com/
*/
// add.php - add a new press release
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Fogra Production </title>
<style type="text/css">
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
<script src="../../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
<style type="text/css">
body,td,th {
font-size: 12px;
}
</style>
<!--
<basefont face="MingLiU">
-->
</head>
<body vlink="#0000FF">
<!-- standard page header begins -->
<a name="DETAILS"></a>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="Navy"><font size="-1" color="White"><b>台藝大NTUA CT23: List</b></font></td>
</tr>
</table>
<!-- standard page header ends -->
<p>
<table style="width=:100%; text-align:left;" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<font size="-1">
<td style="width:100px;">id</td>
<td style="width:50px;">Score</td>
<td style="width:50px;">add up</td>
</font>
</tr>
</tbody>
</table>
<?php
error_reporting(0);
$servername = "127.0.0.1";
$username = "root";
$password = "fredsql";
$DBNAME = "ntua";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
if( !mysqli_select_db($conn, $DBNAME)) {
die ("無法選擇資料庫");
}
mysqli_query( $conn, "SET NAMES 'utf8'");
// generate and execute query
//echo $query;
/*$querys = "SELECT stid, name, MAX(score) AS highest_score
FROM stdrecord where name != 'Fred'
GROUP BY name order by highest_score desc limit 10;
";
*/
$querys = " SELECT stid, name, MAX(score) AS highest_score ,MAX(score*1.05) AS addup FROM stdrecord23 where name != 'Fred' GROUP BY name order by highest_score desc limit 40";
//echo $querys;
$results = mysqli_query($conn, $querys);
$num = mysqli_num_rows( $results);
//$obj = mysqli_fetch_object($results);
if ($num>1) {
while($row = mysqli_fetch_object($results))
{
//echo "name:".$row->name;
$i=$i+1;
if ($row->highest_score>75){
$addup=round($row->highest_score*1.05,0);
}
else {
$addup=75;
}
?>
<table style="width=:100%; text-align:left;" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td style="width:100;"><?php echo $row->stid; ?> </td>
<!--<td style="width:100;"><?php echo $row->name; ?> </td>-->
<td style="width:50;"><?php echo $row->highest_score; ?> </td>
<td style="width:50;"><?php echo round($addup,2); ?> </td>
</tr>
</tbody>
</table>
<p>
<?php
}
}
mysqli_close($conn);
echo "Count=".$i;
?>
<!-- standard page footer begins -->
<p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td align="center"><font size="-2">Everything here is copyright © <a href="http://www.fredkuo.idv.tw/wordpress/">Fred Kuo</a>, 2010. All rights reserved.<br> <a href="http://www.fredkuo.idv.tw/wordpress/?tag=fogra">Read more.</a></td>
</tr>
</table>
<!-- standard page footer ends -->
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"../../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>