close
//connection部分
<?php
<?php
$servername = "ip"; //replace it with your database server name
$username = "user"; //replace it with your database username
$password = "密碼"; //replace it with your database password
$dbname = "資料庫";
// Create connection
$conn = mysql_connect($servername, $username, $password);
mysql_select_db("db", $conn);
mysql_query("set names utf8");
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
// php部分
<ul class="accordionPart">
<li>
<div class="qa_title" style="text-decoration:none;">學年度授課 ▾</div>
<?php $data = mysql_query("select * from Course_Taught where Professor_Id='$teacherID'", $conn); ?>
<div class="qa_content">
<table width="790" bgcolor="black" style="font-size:15px">
<tr>
<td colspan="1" bgcolor="#e3e3e3"><b>Program</b></td>
<td colspan="1" bgcolor="#e3e3e3"><b>Academic Year</b></td>
<td colspan="1" bgcolor="#e3e3e3"><b>Semester</b></td>
<td colspan="1" bgcolor="#e3e3e3"><b>Course Title</b></td>
<td colspan="1" bgcolor="#e3e3e3"><b>Credit hour</b></td>
</tr>
<?php
for($i=0; $i<mysql_num_rows($data); $i++){ //把每一列的資料取出來
$rs=mysql_fetch_row($data);
?><tr>
<input type="hidden" name="course_id[]" onfocus="blur()" value="<?php echo $rs[0] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
<td colspan="1" bgcolor="#FFFFFF">
<input type="text" name="program[]" value="<?php echo $rs[1] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
</td>
<td colspan="1" bgcolor="#FFFFFF">
<input type="text" name="academic_year[]" value="<?php echo $rs[2] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
</td>
<td colspan="1" bgcolor="#FFFFFF">
<input type="text" name="semester[]" value="<?php echo $rs[3] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
</td>
<td colspan="1" bgcolor="#FFFFFF">
<input type="text" name="course_title[]" value="<?php echo $rs[4] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
</td>
<td colspan="1" bgcolor="#FFFFFF">
<input type="text" name="credit_hour[]" value="<?php echo $rs[5] ?>"
style="width:100px; font-size:15px; text-align:center;
text-overflow:ellipsis; overflow: hidden;"/>
</td>
</tr>
<?php }?>
</table>
</div>
</li>
</ul>
全站熱搜
留言列表