溫瑞烘老師的教學歷程檔案(Teaching ePortfolio) - 資管三甲乙資料庫系統教學資源區 - 第11週
 

資訊管理系
副教授
温瑞烘


歷程檔案 Portfolio


關於我 About Me

第11週

第一組
<?php
  include "config.php";
  $PHP_SELF=$_SERVER["PHP_SELF"];
  $command=$_POST["command"];
  if ($command==null)   {
      echo "<html> <body> <center>
                <form method=post action=$SELF_PHP>
                班級代碼
                <select name=choice size=1>
                <option value=''>請選擇班級</option>
               ";
     $sql="select * from dept order by no";
     $result=mysql_query($sql,$conn);
     while ($myrow=mysql_fetch_array($result)) {
           $no=$myrow["no"];
           $name=$myrow["name"];
           echo "<option value='$no'> $name </option>";
     }
     echo "</select>
                <input type=submit name=command value='新增'>
                <input type=submit name=command value='查詢'>
                </form> </center> </body>  </html>
             ";
  }

 if ($command=="查詢")   {
     $choice=$_POST["choice"];
     if ($choice==null) $save_choice="%";
     else $save_choice="%".$choice."%";
     $sql="select * from dept where no like '$save_choice' ";
     $result=mysql_query($sql,$conn);
     $myrow=mysql_fetch_array($result);
     echo "<html> <body> <center>
                <form method=post action=$SELF_PHP>
                班級代碼
                <select name=choice size=1>
                <option value=''>請選擇班級</option>
               ";
     $sql="select * from dept order by no";
     $result=mysql_query($sql,$conn);
     while ($myrow=mysql_fetch_array($result)) {
           $no=$myrow["no"];
           $name=$myrow["name"];
           if ($no==$save_no)
              echo "<option value='$no' selected> $name </option>";
           else
              echo "<option value='$no' > $name </option>";
     }
     echo "</select>
                <input type=submit name=command value='第一筆'>
                <input type=submit name=command value='下一筆'>
                <input type=submit name=command value='上一筆'>
                <input type=submit name=command value='最末筆'>
                <input type=submit name=command value='更新'>
                <input type=submit name=command value='刪除'>
                <input type=hidden  name=save_no value='$save_no'>
                </form> </center> </body>  </html>
             ";
  }
?>



第二組

1. select 班級代碼 班級名稱  學號  姓名
2. 同1 按學號由小至大排序
3. 同1 按學號由大至小排序
4. 同1 按班級代碼, 學號 由小至大排序
5. 同1 按班級代碼, 學號 由大至小排序
6. 同1 按班級名稱, 學號 由小至大排序
7. 同1 按班級名稱, 學號 由大至小排序
8. 同1 按姓名 由小至大排序
9. 同1 按姓名 由大至小排序

下課交紙本作業
















 

全部共 0則留言
登入帳號密碼代表遵守學術網路規範
 


文章分類 Labels

 


最新文章 Top10

中華科技大學數位化學習歷程 - 意見反應