From 9a1fe4b390d56db12966bcab075761c02bc8e178 Mon Sep 17 00:00:00 2001 From: Ye-Yong-Chi <4a2g0039@stust.edu.tw> Date: Sun, 2 Dec 2018 21:32:22 +0800 Subject: [PATCH 1/4] test. --- P8_control.php | 46 ---------------------------------------------- P8_success.php | 37 ------------------------------------- 2 files changed, 83 deletions(-) delete mode 100644 P8_control.php delete mode 100644 P8_success.php diff --git a/P8_control.php b/P8_control.php deleted file mode 100644 index 57251e4..0000000 --- a/P8_control.php +++ /dev/null @@ -1,46 +0,0 @@ - diff --git a/P8_success.php b/P8_success.php deleted file mode 100644 index 25c66df..0000000 --- a/P8_success.php +++ /dev/null @@ -1,37 +0,0 @@ - - - -success - - - - - -

學生查詢系統

-

-學號: -登入次數: -

- -國文:
-英文:
-數學:
-

-平均:
-

-
- - - -
- - - - \ No newline at end of file From 7bc61909a0cb51f81e90a46dbd8c3570762ddd87 Mon Sep 17 00:00:00 2001 From: Ye-Yong-Chi <4a2g0039@stust.edu.tw> Date: Sun, 2 Dec 2018 21:36:58 +0800 Subject: [PATCH 2/4] complete project. --- P8_fail.php | 19 ++++++------- P8_search.php | 75 ++++++++------------------------------------------ P8_success.php | 58 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 75 deletions(-) create mode 100644 P8_success.php diff --git a/P8_fail.php b/P8_fail.php index 9eddfe3..eae9277 100644 --- a/P8_fail.php +++ b/P8_fail.php @@ -4,16 +4,13 @@ P8_fail -
-

基本資料管理系統-查詢

- -
- -

編號:

-

!資料不存在!

- - -
-
+
+

基本資料管理系統-查詢

+
+

+

!資料不存在!

+ +
+
\ No newline at end of file diff --git a/P8_search.php b/P8_search.php index b5b426b..cbe036b 100644 --- a/P8_search.php +++ b/P8_search.php @@ -1,71 +1,18 @@ + -P8_search +P8_search.php -"); - mysqli_select_db($link, "myschool"); // 選擇myschool資料庫 - //送出UTF8編碼的MySQL指令 - mysqli_query($link, 'SET NAMES utf8'); - // 執行SQL查詢 - $result = @mysqli_query($link, $sql); - $_POST['No']; - if ( mysqli_errno($link) != 0 ) { - header("Location:P8_fail.php"); - } - else { - echo ""; - echo ""; - while ( $meta = mysqli_fetch_field($result) ) - echo ""; - echo ""; - // 取得欄位數 - $total_fields = mysqli_num_fields($result); - while ($rows = mysqli_fetch_array($result, MYSQLI_NUM)) { - echo ""; - for ( $i = 0; $i < $total_fields; $i++ ) - echo ""; - echo ""; - } - echo "
".$meta->name."
".$rows[$i]."
"; - } - mysqli_close($link); // 關閉資料庫連接 - } -else - $sql = "SELECT * FROM users where No="; -?> -
-

基本資料管理系統-查詢

- -
- - -

編號:

- - - -
-
+
+

基本資料管理系統-查詢

+
+ +
+ + +
+
\ No newline at end of file diff --git a/P8_success.php b/P8_success.php new file mode 100644 index 0000000..1d94724 --- /dev/null +++ b/P8_success.php @@ -0,0 +1,58 @@ + + + +P8_fail + + +

基本資料管理系統-查詢

+
+
+ "); + //送出UTF8編碼的MySQL指令 + mysqli_query($link, 'SET NAMES utf8'); + // 執行SQL查詢 + $result = mysqli_query($link, $sql); + if ($result) { + // 返回資料筆數 + $rowcount = mysqli_num_rows($result); + // echo var_dump($rowcount); + if ($rowcount > 0) { + // 取得欄位數值 + while ($rows = mysqli_fetch_array($result, MYSQLI_NUM)) { + echo "

編號:".$rows[0]."

"; + echo "

姓名:".$rows[1]."

"; + echo "

地址:".$rows[2]."

"; + echo "

電話:".$rows[3]."

"; + echo "

生日:".$rows[4]."

"; + echo "

Email:".$rows[5]."

"; + echo "

等級:".$rows[6]."

"; + // echo var_dump($rows); + } + mysqli_free_result($result); + } + else { + header("Location:P8_fail.php"); + } + } + else if ( mysqli_errno($link) != 0 ) { + header("Location:P8_fail.php"); + } + + mysqli_close($link); // 關閉資料庫連接 + } + else { + header("Location:P8_fail.php"); + } + ?> + +
+
+ + \ No newline at end of file From 47f606f63f1b5fe80e3a37068a65e102773e101a Mon Sep 17 00:00:00 2001 From: Ye-Yong-Chi <4a2g0039@stust.edu.tw> Date: Mon, 3 Dec 2018 01:54:20 +0800 Subject: [PATCH 3/4] modify some sql method. --- P8_fail.php | 18 ++---------------- P8_search.php | 4 ++-- P8_success.php | 8 ++++---- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/P8_fail.php b/P8_fail.php index eae9277..3d2b9f1 100644 --- a/P8_fail.php +++ b/P8_fail.php @@ -1,16 +1,2 @@ - - - -P8_fail - - -
-

基本資料管理系統-查詢

-
-

-

!資料不存在!

- -
-
- - \ No newline at end of file +

+

!資料不存在!

\ No newline at end of file diff --git a/P8_search.php b/P8_search.php index cbe036b..32530ba 100644 --- a/P8_search.php +++ b/P8_search.php @@ -5,9 +5,9 @@ P8_search.php +

基本資料管理系統-查詢

+
-

基本資料管理系統-查詢

-

diff --git a/P8_success.php b/P8_success.php index 1d94724..b9afef5 100644 --- a/P8_success.php +++ b/P8_success.php @@ -22,7 +22,7 @@ if ($result) { // 返回資料筆數 $rowcount = mysqli_num_rows($result); - // echo var_dump($rowcount); + // printf("資料筆數 : %d", $rowcount); if ($rowcount > 0) { // 取得欄位數值 while ($rows = mysqli_fetch_array($result, MYSQLI_NUM)) { @@ -38,17 +38,17 @@ mysqli_free_result($result); } else { - header("Location:P8_fail.php"); + include("P8_fail.php"); } } else if ( mysqli_errno($link) != 0 ) { - header("Location:P8_fail.php"); + include("P8_fail.php"); } mysqli_close($link); // 關閉資料庫連接 } else { - header("Location:P8_fail.php"); + include("P8_fail.php"); } ?> From 2d3e014a78b0045277f7f071664259ccad851374 Mon Sep 17 00:00:00 2001 From: Ye-Yong-Chi <4a2g0039@stust.edu.tw> Date: Mon, 3 Dec 2018 02:00:03 +0800 Subject: [PATCH 4/4] complete project. --- P8_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/P8_search.php b/P8_search.php index 32530ba..1df08bb 100644 --- a/P8_search.php +++ b/P8_search.php @@ -9,7 +9,7 @@
-
+