Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
資料庫概論
期末報告 組別:第 1組
系級:資圖 3A
組員:
林芷筠 400000914
鍾湘慈 400000815
簡如倩 400000732
王 笙 400000856
鄭欣杰 400004056
一. 前言
台灣高等教育在過去數十年來的快速擴充,大專院校的數量也與日俱增,如
今台灣的大學升學率達到百分之百。大專院校也開始分門別類,種類多樣化。
再加上近年來訂立了一系列東南亞以及中國大陸的學生開放來台就讀台灣大
專院校的政策,吸引了大量的僑生以及陸生。遠在異地的他們迫切地希望獲
取一些台灣大專院校的訊息,而這個網站正好為他們提供了一定程度(一般大
學)上的便利。
二. 動機與目的
台灣雖然小,但是在這座小小的島嶼上也存在著南北差異,光是北、中、南、
外島的大學就接近 6、70 所。從小就生長在台北的我們,竟然對於北部以外
的大學一無所知,一方面是因為我們對於地理概念可能就不是很好,另一方
面我們是不是太安逸於現在所生活的環境而忘了要去關心台灣其他的地區了
呢?
藉由這個網站,希望對於想要了解台灣大學分類的莘莘學子能有幫助,我們
除了用基本的分類:公立私立、是為大學?是否為專業分類的大學,例如醫
學大學。除此之外我們也附上學校地址,有了地址,對於學校的位置也能有
更準確的概念,不再只停留在、北、中、南、離島的粗略概念了。
在校系查詢上,我們可以搜尋學校或是系,搜尋學校的話就是會列出這所學校
所有的系所;如果想要搜尋校系的話,則是會列出所有有這個系的學校,例
如搜尋中國語文學系,將會跑出所有有這個系所的學校列表。
而在這個網站我們也希望能夠做到即時更新的功能,因為許多學校經常增加
或減少科系,而時常也多成立了一所學校,或是學校改名,這些變動我們都
希望能讓使用者快速地知道,而擁有新的資訊。
三. 使用對象
藉由我們的搜尋系統,可以讓全國的準大學生,或是所有對於大學分佈有興
趣甚至是需求的人,都可以得到資訊的滿足。讓大學的位置不再只是一個虛
無飄渺的概念,在使用過我們的網站之後都可以擁有全方位的概念。也可以
作為填志願的參考。
此外如果有特別鎖定系所想去就讀的準大學生們,也可以利用我們系所搜尋
的功能,將所有有這個系所的大學聚集在一起,方便學生進行必較跟評估。
四. 主題說明
從以前人們就認為受教育是為了以後出社會有更好的發展,而發展高等教育
能使國家增強競爭力,隨著現在全球化的發展下,各國也相繼在教育方面做
改革。
台灣從 1950 年代台灣的大學只有四所,要考上大學是一件很困難的事情,開
始高等教育開始有了變化,大學生的錄取率也相對提高,在這個年代升大學
的機率幾乎為 100%。學生不再只為了文憑取得而去念大學,現在的學生跟以
前相比多了很多的選擇權,除了學校變多了以外,也多出了很多以往沒有的
系所可以選擇,更可以按照自己的喜好來選擇要念哪間大學,多方考慮學校
的特色以及距離等因素之後,準大學生就可以「擇其所愛」的去念大學了。
在此我們不包括科技大學,在學測申請中,一般大學和科技大學是分開的,
目前我們只提供一般高中大多繼續就讀的一般大學作為內容。
五.資料庫架構
(一)資料表:3 個
1.university:大學名單
2.department:科系
3.choose:大學與科系 校系
①University
為台灣所有一般大學的清單
5 欄位 uid/utime/uform/uname/place
70 筆資料
②Department
為台灣所有的科系,為科系清單
2 欄位有 did/dname
1086 筆資料
③choose
為 university 和 department 的連結,目前有 1717 筆資料
2 欄位 no(學校) / id(科系)
(二)資料庫結構
六.網站架構
六.網站架構
大學
公立
大學
師範大學/教育大學
藝術大學
體育大學
私立
大學
醫學大學/醫藥大學
查詢
增加校系
刪校系
改校系
七.程式碼
1.首頁
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>台灣大專院校</title>
</head>
<body>
<table border="0" width="100%" height="90"bgcolor="#004C80"><tr><td
align="center"><h1><font color="white">台灣大學列表</h1></td></tr></table>
<table align="center" cellpadding="10" cellspacing="10" width="100%" height="80"
border="0" >設定表格置中,Cellpadding:指定內容與格線之間的間距、cellspacing:
指定格線與格線之間的距離
<tr>
<td colspan="6" align="center">
<form action="search1.php" method="post">
<select name="field">
<option value="id">公私立</option>
<option value="name">校名</option>
<option value="time">時間</option>
<option value="place">地點</option>
<option value="department">科系</option>
</select>
<input type="text" name="key">
<input type="submit" value="搜尋">
</form>
</td>
</tr>
<tr bgcolor="#004C80">
<th width="174" align="center" ><font size="4"><a href="B1/B.html"><font
color="white">學校選擇</a></th>
<th width="174" align="center" ><font size="4"><a href="B2/B.html"><font
color="white">學生名單</a></th>
<th width="178" align="center" ><font size="4"><a href="B1/B.html"><font
color="white">各校系錄取名單</a></th>
下拉式搜尋選單
<th width="174" align="center" ><font size="4"><a href="member.html"><font
color="white">關於我們</a></th>
</tr>
<tr> <td colspan="4" align="center"> <img src="o52WnqaXk.jpg" width="500"
height="500" /></td> </tr>
</table>
</body>
</html>
2.學校選擇
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>一般大學</title>
</head>
<BODY>
<table border="0" width="100%" height="90" bgcolor="#004C80" ><tr><td
align="center"><h1><font color="white"><a href="../index.html">台灣大學列表
</h1></td></tr></table>標題框框顏色;字體顏色
<table align="center" width="50%" height="80" border="0" ><tr><td><marquee
scrollamount=6><img src=" "><font color="#ff1493" size="6"><b>歡迎參觀
喔!!!</b></font></marquee>用無框線表格固定跑馬燈,設定長占網頁長 80%寬 50%,
跑馬燈內字體為 6、速度為 6
</table>
<table align="center" cellpadding="10" cellspacing="10" width="50%" height="80"
border="0" >
<tr>
<th width="174" ><font size="4">學校選擇</a></th>
<th width="174" ><font size="4"><a href="../B2/B.html">學生名單</a></th>
<th width="178" ><font size="4"><a href="../B2/B.html">各校系錄取名單
</a></th>
<th width="174" ><font size="4"><a href="../member.html">關於我們</a></th>
</tr>
</table>
<table border="0" align="center" width="80%" cellpadding="5" cellspacing="10" >
<tr>
<td colspan="6" bgcolor="#004C80" > <h2 align="center"> <font color="white"> 公立大學
</h2> </td>第一層項目一
</tr>
<tr>
<td align="center"><li><a href="C1/a1.html">大學</a></td>第二層子項一
<td align="center"><li><a href="C1/a2.html">師範/教育大學</a></td>第二層子項二
<td align="center"><li><a href="C1/a3.html">藝術大學</a></td>
<td align="center"><li><a href="C1/a4.html">體育大學</a></td>
</tr>
<tr> <td colspan="6" bgcolor="#004C80" align="center"><h2 align="center">
<font color="white">私立大學 </h2></td> <tr>第一層項目二
<tr>
<td colspan="2" align="center"><li><a href="C1/b1.html">大學</a></td>
第一層項目二的第二層子項一
<td colspan="2" align="center"><li><a href="C1/b2.html">醫學大學/醫藥大學</a></td>
</tr>
</body>
</html>
3.大學分類頁面
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>公立大學</title>
</head>
<BODY >
<table border="0" width="100%" height="90" bgcolor="#004C80" ><tr><td
align="center"><h1><a href="../../index.html" color="white"><font >台灣大學列表
</h1></td></tr></table>
<table align="center" width="50%" height="80" border="0" ><tr><td><marquee
scrollamount=6><img src="../../q.gif"><font color="#ff1493" size="6"><b>歡迎參觀
喔!!!</b></font></marquee>
</table>
<table align="center" cellpadding="10" cellspacing="10" width="50%" height="80"
border="0" >
<tr>
<th width="174" ><font size="4"><a href="../../B1/B.html">學校選擇</a></th>
<th width="174" ><font size="4"><a href="../../B2/B.html">學生名單</a></th>
<th width="178" ><font size="4"><a href="../../B2/B.html">各校系入取名單
</a></th>
<th width="174" ><font size="4"><a href="../../member.html">關於我們</a></th>
</tr>
</table>
<p>
<table border="0" align="center" width="80%" cellpadding="5" cellspacing="10" >
<tr>
<td colspan="6" bgcolor="#004C80"> <h2 align="center"> <font color="white"> 大學
</h2> </td>
</tr>
<tr bgcolor="#004C80" >
<td ><font color="white"><p align="center">校徽</td>
<td ><font color="white"><p align="center">學校名稱</td>
<td ><font color="white"><p align="center">創校時間</td>
<td ><font color="white"><p align="center">地址</td>
<td ><font color="white"><p align="center">網址</td>
</tr>
<tr>
<td ><img src=pa1/ntu.jpg width=100 height=100 ></td>
<td ><a href="DA1/ntu.html">國立台灣大學</td>
<td ><p align="center">1928 年</td>
<td >臺北市大安區羅斯福路四段 1 號</td>
<td ><p align="center"><a href="http://www.ntu.edu.tw/">網址</td>
</tr>
做成此表格
國立/私立 學校名稱 創校時間 地址 網址
國立 台灣大學 1928 臺北市大安區羅斯福路四段 1 號 網址
4.科系頁面
<?php
echo"<h2>hihi</h2>";
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
$sql = "SELECT *
$sql = "select department.dname as depart
FROM university, department, choose WHERE university.uid = choose.uid
AND department.did = choose.did
AND university.uid = '10'";
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo '<table align="center" border="0" width="80%" height="90">';
echo '<tr><th>科系</th></tr>';
while ($row != NULL){
list($depart) = $row;
echo "<tr>";
echo "<td><p align=center >$depart</td></tr>";
echo "a";
$row = mysql_fetch_row($result);
}
echo '</table>';
?>
從 choose資料表中撈出
選擇該大學號碼
5.搜尋頁面
<?php
echo "<h2></h2>";
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
$key = $_POST['key'];
$field = $_POST['field'];
$sql = "SELECT *
FROM university, department, choose
WHERE university.uid = choose.uid
AND department.did = choose.did
AND $field like'%$key%'";
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
$result = mysql_query($sql) or die(mysql_error());;
$row = mysql_fetch_row($result);
if ($key !="") {
echo '<table border="0" align="center" width="80%" cellpadding="5" cellspacing="10"
">';
echo '<tr></th><th>公私立</th><th>校名</th><th>時間</th><th>地點</th><th>科系
</th></tr>';
while ($row != NULL){
list($uid,$utime,$uform,$uname,$place,$did,$dname,$uid,$did ) = $row;
echo"<tr>";
echo "<td ><p align=center >$uform</b></td>";
echo "<td ><p align=center >$uname</td>";
echo "<td ><p align=center >$utime</b></td>";
echo "<td ><p align=center >$place</b></td>";
echo "<td ><p align=center >$dname</b></td>";
echo"</tr>";
$row = mysql_fetch_row($result);
}
echo '</table>';
從 choose 資料表
}
?>
6.增加科系
<?php
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
$sql = "select*from university";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo "<form>";
echo"<select>";
while ($row != NULL){
list($uid,$uform,$place,$uname) = $row;
echo "<option value=$uid>$uid $uname </option>";
$row = mysql_fetch_row($result);
}
echo "</select>";
?>
<?php
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
科系下拉表單
科系下拉表單
$sql = "select*from department";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo "<P></P>";
echo"<select>";
while ($row != NULL){
list($did,$dname) = $row;
echo "<option value=$did>$did $dname </option>";
$row = mysql_fetch_row($result);
}
echo "</select>";
echo "</form>";
?>
</tr></td>
<tr><td bgcolor="#004C80" align="center" ><font color="white" size="4" >增加科系
</td></tr>
<tr><td>
<form action="" method="post">
大學編號<input type="text" name="uid"><br>
科系編號<input type="text" name="did"><br>
<input type="submit" value="送出">
</form>
<?php
$uid=$_POST["uid"];
$did=$_POST["did"];
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
新增校系
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
if($uid and $did ){
$sql = "insert into choose(uid,did)values('$_POST[uid]','$_POST[did]')";
$result = mysql_query($sql) or die(mysql_error());
$sql =$sql = $sql = "SELECT *
FROM university, department, choose
WHERE university.uid = choose.uid
AND department.did = choose.did ";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
}
?>
</td></tr>
<tr><td bgcolor="#004C80" align="center" ><font color="white" size="6" >另增
校系</td></tr>
<tr><td bgcolor="#004C80" align="center" ><font color="white" size="4" >新增
大學</td></tr>
<tr><td bgcolor="white" align="center" ><font color="#004C80" size="4" >若上方無
您要的學校請自行於此輸入增加後再前往上一步合併所需科系</td></tr>
<tr><td>
<form action="" method="post">
編號<input type="text" name="uid"><br>
時間<input type="text" name="utime"><br>
公/私立<input type="text" name="uform"><br>
校名<input type="text" name="uname"><br>
新增至 choose 表單
地址<input type="text" name="place"><br>
<input type="submit" value="送出">
</form>
<?php
$uid=$_POST["uid"];
$utime=$_POST["utime"];
$uform=$_POST["uform"];
$uname=$_POST["uname"];
$place=$_POST["place"];
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
if($uid and $utime and $uform and $uname and $place ){
$sql = "insert into
university(uid,utime,uform,uname,place)values('$_POST[uid]','$_POST[utime]','$_POST[u
form]','$_POST[uname]','$_POST[place]')";
$result = mysql_query($sql) or die(mysql_error());
$sql = "select * from university where uname like '$uname'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo '<table border="0" align="center" width="80%" cellpadding="5" cellspacing="10"
">';
echo '<tr></th><th>公私立</th><th>校名</th><th>時間</th><th>地點</th></tr>';
while ($row != NULL){
list($uid,$utime,$uform,$uname,$place,$did,$dname,$uid ) = $row;
echo"<tr>";
echo "<td ><p align=center >$uform</b></td>";
單純新增學校資料
新增至 university表
單
echo "<td ><p align=center >$uname</td>";
echo "<td ><p align=center >$utime</b></td>";
echo "<td ><p align=center >$place</b></td>";
echo "<td ><p align=center >$dname</b></td>";
echo"</tr>";
$row = mysql_fetch_row($result);
}
echo '</table>';
}
?>
</td></tr>
<tr><td bgcolor="#004C80" align="center" ><font color="white" size="4" >新增科
系</td></tr>
<tr><td bgcolor="white" align="center" ><font color="#004C80" size="4" >若上方無
您要的科系請自行於此輸入增加後再前往上一步合併所需科系</td></tr>
<tr><td>
<form action="" method="post">
編號<input type="text" name="did">
科系名<input type="text" name="dname"><br>
<input type="submit" value="送出">
</form>
<?php
$did=$_POST["did"];
$dname=$_POST["dname"];
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
單純新增科
系
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
if($did and $dname ){
$sql = "insert into
department(did,dname)values('$_POST[did]','$_POST[dname]')";
$result = mysql_query($sql) or die(mysql_error());
$sql = "select * from department where dname like '$dname'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo '<table border="0" align="center" width="80%" cellpadding="5" cellspacing="10"
">';
echo '<tr></th><th>編號</th><th>科系</th></tr>';
while ($row != NULL){
list($did,$dname ) = $row;
echo"<tr>";
echo "<td ><p align=center >$did</b></td>";
echo "<td ><p align=center >$dname</td>";
echo"</tr>";
$row = mysql_fetch_row($result);
}
echo '</table>';
}
?>
</td></tr>
<tr><td bgcolor="#004C80" align="center" ><font color="white" size="6" >提
醒!!!</td></tr>
<tr><td bgcolor="white" align="center" ><font color="#004C80" size="4" >由
於新增的校系有待管理員審核,故頁面暫時無法顯示,
但新增後於可先於查詢欄位顯示資料</td></tr>
新增至 department
表單
</table >
7.刪除校系
<form action="" method="post">
大學編號<input type="text" name="uid"><br>
科系編號<input type="text" name="did"><br>
<p>
<input type="submit" value="送出">
</p>
</form>
<?php
$uid=$_POST["uid"];
$did=$_POST["did"];
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
if($uid and $did ){
$sql = "delete from choose where uid='$_POST[uid]'and did='$_POST[did]'";
$result = mysql_query($sql) or die(mysql_error());
$sql = "select * from choose ";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo'資料刪除成功';
//echo '<table border="0" align="center" width="80%" cellpadding="5"
cellspacing="10" ">';
//echo '<tr><th>校名</th><th>科系</th></tr>';
從 choose 裡面刪除
刪除校系
while ($row != NULL){
list($uid,$did ) = $row;
//echo"<tr>";
//echo "<td ><p align=center >$uid</b></td>";
//echo "<td ><p align=center >$did</td>";
//echo"</tr>";
$row = mysql_fetch_row($result);
}
// echo '</table>';
}
?>
8.更改科系
<?php
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
$uid=$_POST["uid"];
$rename=$_POST["rename"];
if($uid and $rename ){
$sql = "update university set uname='$_POST[rename]' where uid='$_POST[uid]'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
$sql = "select * from university where university.uname like '$rename'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo '<table align="center" width="50%" height="80" border="2" >';
echo '<tr><th>編號</th><th>公/私立</th><th>校名</th><th>時間</th><th>地
址</th></tr>';
while ($row !=NULL){
更正大學名稱
更正 university表單
list ($uid,$utime,$uform,$uname,$place)= $row;
echo "<tr>";
echo "<td>$uid</td>";
echo "<td>$uform</td>";
echo "<td>$uname</td>";
echo "<td>$utime</td>";
echo "<td>$place</td>";
echo "</tr>";
//$sql = "select * from choose ";
//$result = mysql_query($sql) or die(mysql_error());
//$row = mysql_fetch_row($result);
//echo'';
//echo '<table border="0" align="center" width="80%" cellpadding="5"
cellspacing="10" ">';
//echo '<tr><th>校名</th><th>科系</th></tr>';
// while ($row != NULL){
//list($uid,$did ) = $row;
//echo"<tr>";
//echo "<td ><p align=center >$uid</b></td>";
//echo "<td ><p align=center >$did</td>";
echo"</tr>";
$row = mysql_fetch_row($result);
}
echo '</table>';
}
?>
<?php
$link = mysql_connect('localhost', '102dba01', '102dba01');
mysql_select_db("102dba01", $link) or die("資料庫連結錯誤");
mysql_query('SET NAMES utf8');
mysql_query('SET CHARACTER_SET_CLIENT=utf8');
科系資料更
正
mysql_query('SET CHARACTER_SET_RESULTS=utf8');
$did=$_POST["did"];
$rename=$_POST["rename"];
if($did and $rename ){
$sql = "update department set dname='$_POST[rename]' where
did='$_POST[did]'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
$sql = "select * from department where department.dname like '$rename'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row($result);
echo '<table align="center" width="50%" height="80" border="2" >';
echo '<tr><th>編號</th><th>科系</th></tr>';
while ($row !=NULL){
list ($did,$dname)= $row;
echo "<tr>";
echo "<td>$did</td>";
echo "<td>$dname</td>";
echo "</tr>";
//$sql = "select * from choose ";
//$result = mysql_query($sql) or die(mysql_error());
//$row = mysql_fetch_row($result);
//echo'';
//echo '<table border="0" align="center" width="80%" cellpadding="5"
cellspacing="10" ">';
//echo '<tr><th>校名</th><th>科系</th></tr>';
// while ($row != NULL){
//list($uid,$did ) = $row;
//echo"<tr>";
//echo "<td ><p align=center >$uid</b></td>";
更新至 department
表單
//echo "<td ><p align=center >$did</td>";
echo"</tr>";
$row = mysql_fetch_row($result);
}
echo '</table>';
}
?>
八.待修改之處
1.增刪改的部分,希望能夠將下拉表單直接點選,而非單單於參考之用,顯為可
惜。
2.查詢頁面希望同樣項目不必再重複,例如:”淡江”中文系、”淡江”資圖系