原程式碼如下:
<?php
header("Content-type: text/html; charset=utf-8");
require_once("connect.php");
$conn = mysql_connect("localhost", $dbuser, $dbpass) or die('Error with MySQL connection');
mysql_query("SET NAMES 'utf8'");
mysql_select_db($dbname);
session_start();
$id = $_SESSION['id'];
$name = $_SESSION['name'];
$tablename = $_SESSION['tablename'];
$sql2 = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '107-1-7B-w1'";
$result2 = mysql_query($sql2) or die('MySQL query error222');
$sql = "select * from `107-1-7B-w1` where id = '$id'";
$result = mysql_query($sql) or die('MySQL query error111');
?>
<html>
<head>
<title>國中國7B班資訊系統</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
107學年度暑期結業考成績
學生姓名:<?php echo $name; ?>
***<?php echo $id; ?>***
"; echo $row2[$j]; echo " | ";
"; echo $row[$j]; echo " | ";