---
# System prepended metadata

title: MYSQL 網丙 AppServ
tags: [PHP&MYSQL, 網丙]

---

# MYSQL 網丙 AppServ
###### tags: `網丙` `PHP&MYSQL` 


---
```sequence
資料庫->news:建立資料夾
資料庫->student:建立資料夾

Note right of news: 1.newscenter
Note right of news: 2.newsadmin
Note right of student: 1.student
```

---


### 1.安裝AppServ 2.5.10 
:::danger
如果已安裝XAMPP就不用安裝這套
一台電腦一個伺服器才不會有問題

C:\xampp\phpMyAdmin\config.inc.php  
修改相同密碼才能再登入apache資料庫
![](https://i.imgur.com/QMU717A.png)

:::

---

### 2.設定環境資料
新增資料表newscenter
![](https://i.imgur.com/X61KFkn.png)


---


### 2.新增資料表newsadmin
設定帳號密碼
![](https://i.imgur.com/HCfLQbE.png)


---


### 3.匯入CSV格式資料
1.匯入前先在資料表建立資料欄位
![](https://i.imgur.com/yNlMeOK.png)

2.匯入CSV檔案
![](https://i.imgur.com/HkldbLs.png)

| Excel表格  | 說明|
|----------|------|
|student_photo|    |
|=B2&".jpg"| stud_name + .jpg   |


### 4.設定Dreamweaver環境
1.在C:\AppServ\www\hometown新增幾個資料夾
```sequence
hometown->資料夾:
Note right of 資料夾: images\n music \n results \n others

```
2.開啟Dreamweaver，建立新網站
* 網站名稱:我的家鄉(故鄉新訊管理系統)
* 本機資料夾:C:\AppServ\www\hometown
![](https://i.imgur.com/q50hfMb.png)


* 伺服器
    * 伺服器名稱:localhost
    * 連線方式:本機/網路
    * 伺服器資料夾:C:\AppServ\www\hometown
    * Web URL:http://localhost/hometown/

![](https://i.imgur.com/VAKlUs1.png)
![](https://i.imgur.com/wPaEMkk.png)

* 測試的地方記得打勾
![](https://i.imgur.com/VDrKsz1.png)

:::info
**可以直接匯出網站檔案，可直接在別台電腦設定一樣的內容**
檔名會是 "我的家鄉.ste"
:::

---


### 5.依照4的步驟再新增一個student的站台

* 網站名稱:學生資料管理系統
* 本機資料夾:C:\AppServ\www\student



### 6.製作網站版面
* 新增表格4列1欄，寬度1024px
* 加入JS萬年曆程式碼
    :::spoiler
    ```
    <script LANGUAGE="JavaScript" TYPE="text/javascript">
      onload="startclock(); timerONE=window.setTimeout"
    var vn="Microsoft Internet Explorer";
    var some;
    if(navigator.appName!=vn)
    some=1900;
    else
    some=0;
    function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
    {
    this[0] = m0;
    this[1] = m1;
    this[2] = m2;
    this[3] = m3;
    this[4] = m4;
    this[5] = m5;
    this[6] = m6;
    this[7] = m7;
    this[8] = m8;
    this[9] = m9;
    this[10] = m10;
    this[11] = m11;
    }
    function calendar()
    {
    var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
    var today = new Date();
    var thisDay;
    var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    year = today.getYear();
    thisDay = today.getDate();
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
    nDays = monthDays[today.getMonth()];
    firstDay = today;
    firstDay.setDate(1); // works fine for most systems
    testMe = firstDay.getDate();
    if (testMe == 2) firstDay.setDate(0);
    startDay = firstDay.getDay();
    document.write('<table border="0" cellspacing="0" cellpadding="2" align="CENTER" bgcolor="#0080FF"><TR><TD><table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="Silver">');
    document.write('<TR><th colspan="7" bgcolor="#C8E3FF">');
    var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
    var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
    var now = new Date();
    document.write("<font style=font-size:9pt;Color:#330099>" , "西元" , " " , now.getYear() + some , "年" , " " , monthNames[now.getMonth()] , " " , now.getDate() , "日" , " " , dayNames[now.getDay()] , "</FONT>");
    document.writeln('</TH></TR><TR><TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">日</FONT></TH>');
    document.writeln('<th bgcolor="#0080FF"><font style="font-size:9pt;Color:White">一</FONT></TH>');
    document.writeln('<TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">二</FONT></TH>');
    document.writeln('<TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">三</FONT></TH>');
    document.writeln('<TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">四</FONT></TH>');
    document.writeln('<TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">五</FONT></TH>');
    document.writeln('<TH BGCOLOR="#0080FF"><font style="font-size:9pt;Color:White">六</FONT></TH>');
    document.writeln("</TR><TR>");
    column = 0;
    for (i=0; i<startDay; i++)
    {
    document.writeln("\n<TD><FONT style=font-size:9pt> </FONT></TD>");
    column++;
    }
    for (i=1; i<=nDays; i++)
    {
    if (i == thisDay)
    {
    document.writeln('</TD><td align="CENTER" bgcolor="#FF8040"><FONT style=font-size:9pt;Color:#ffffff><B>')
    }
    else
    {
    document.writeln('</TD><TD BGCOLOR="#FFFFFF" ALIGN="CENTER"><FONT style=font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066>');
    }
    document.writeln(i);
    if (i == thisDay) document.writeln("</FONT></TD>")
    column++;
    if (column == 7)
    {
    document.writeln("<TR>"); 
    column = 0;
    }
    }
    document.writeln('<TR><td colspan="7" align="CENTER" valign="TOP" bgcolor="#0080FF"><form name="clock" onSubmit="0"><FONT style=font-size:9pt;Color:#ffffff>現在時間：</FONT><INPUT TYPE="Text" NAME="face" ALIGN="TOP"></TD></TR></TABLE></TD></TR></TABLE></FORM>');
    }
    var timerID = null;
    var timerRunning = false;
    function stopclock ()
    {
    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;
    }
    function showtime()
    {
    var now = new Date()
    var hours = now.getHours()
    var minutes = now.getMinutes()
    var seconds = now.getSeconds()
    var timeValue = ""
    if(hours>=1 && hours <4)
    {timeValue += ("凌晨")}
    if(hours>=4 && hours<6)
    {timeValue += ("清晨")}
    if(hours>=6 && hours<9)
    {timeValue += ("早上")}
    if(hours>=9 && hours<12)
    {timeValue += ("上午")}
    if(hours>=12 && hours<13)
    {timeValue += ("中午")}
    if(hours>=13 && hours<18)
    {timeValue += ("下午")}
    if(hours>=18 && hours <19)
    {timeValue += ("傍晚")}
    if(hours>=19 && hours <24)
    {timeValue += ("晚上")}
    if(hours<1)
    {timeValue += ("午夜")}
    timeValue += ((hours > 12) ? hours - 12 : hours)
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    document.clock.face.value = timeValue
    timerID = setTimeout("showtime()",1000)
    timerRunning = true
    }
    function startclock ()
    {
    stopclock();
    showtime();
    }
    </script>
    <script LANGUAGE="JavaScript" TYPE="text/javascript"> 
    <!--
    calendar(); 
    //--> 
    </script> 

    <body onload="startclock(); timerONE=window.setTimeout">
    ```
    :::
    * 插入>版面物件>AP Div
![](https://i.imgur.com/DmFZnl1.png)

* 首頁|地理位置|新訊傳達|食在美味|景點瀏覽|圖片總覽
* 




### 7.設定資料庫
:::info
步驟紀錄:
* 在results資料夾建立main.html
* 在內容區建立內置框架並指定相關參數(iframes指定main框架)
* 在網頁內插入音效mp3
* 登入教師端 複製 後台資料夾所有檔案，貼到hometown資料夾
* 設定"新訊傳達"文字超連結index.php  目標:main
:::
![](https://i.imgur.com/8kRz3CB.jpg)

**以下在stud.php進行**
1. ![](https://i.imgur.com/9O9CYpU.png)
2. ![](https://i.imgur.com/w07TDQ5.png)

記得在Connections>**stud.php**加上<span class="code1">mysql_query('SET names utf8')</span>


**以下在index.php進行**

* 視窗>繫結>資料集查詢
    * 表格:newscenter 
    * 排序:news_date 遞減
![](https://i.imgur.com/ExF4giD.png)

拖拉繫結內容到框框裡
![](https://i.imgur.com/D1OA8cr.png)


* 視窗>伺服器行為 +
    * 重複區域:顯示10筆
    ![](https://i.imgur.com/C0W8BvB.png)
    ![](https://i.imgur.com/HiWiiSe.png)
    * 點選第二格整列重複
    ![](https://i.imgur.com/Unxk4LP.png)


* 插入>導覽狀態
    * 選下面那一格左邊插入
    * ![](https://i.imgur.com/eKt9mVH.png)

* 插入>資料集導覽列
    * 顯示方式:文字
    * ![](https://i.imgur.com/K4JcPZ2.png)

    
---
<style>
h2 {
    color: #2383F8;
}
h3 {
    color: #1AA340;
}
h4 {
    color: white;
    background-color: #2383F8;
    padding:8px;
}

.code1 {
    padding: 2px 4px;
    font-size: 90%;
    color: #c7254e;
    background-color: #f9f2f4;
    border-radius: 4px;
    font-family:'Fira Code';
}
.code {
    padding: 2px 4px;
    font-size: 90%;
    font-family:'Fira Code';
}
</style>