From 10a6f298931e6965dae496f66edb17e5530b82ff Mon Sep 17 00:00:00 2001 From: hungdm Date: Tue, 23 Apr 2024 22:12:16 +0700 Subject: [PATCH 1/3] update connect database --- database/connect.php | 21 +++++++++++++++++++++ database/index.php | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 database/connect.php create mode 100644 database/index.php diff --git a/database/connect.php b/database/connect.php new file mode 100644 index 000000000..eb79b69d1 --- /dev/null +++ b/database/connect.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/database/index.php b/database/index.php new file mode 100644 index 000000000..e961f6840 --- /dev/null +++ b/database/index.php @@ -0,0 +1,19 @@ +query($sql) === TRUE) { + echo "done"; +} else { + echo "Error: " . $connect->error; +} +$connect->close(); +?> \ No newline at end of file From c3c943e82ec9e3c67ae213fcf422c4b2db8df33e Mon Sep 17 00:00:00 2001 From: hungdm Date: Fri, 26 Apr 2024 21:26:57 +0700 Subject: [PATCH 2/3] update database student --- database/index.php | 72 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/database/index.php b/database/index.php index e961f6840..6e2b36cf5 100644 --- a/database/index.php +++ b/database/index.php @@ -1,19 +1,55 @@ -Danh mục sinh viên đăng ký môn học + + + + + + + + + connect_error) { + die("Kết nối CSDL thất bại: " . $connect->connect_error); + } + $sql = "SELECT sinhvien.MSSV, sinhvien.HoTen, monhoc.MaMH, monhoc.TenMH, dangky.Ky + FROM dangky + JOIN sinhvien ON dangky.MSSV = sinhvien.MSSV + JOIN monhoc ON dangky.MaMH = monhoc.MaMH;"; + $result = $conn->query($sql); + if ($result) { + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } else { + echo ""; + } + } else { + echo "Error: " . $conn->error; + } + $conn->close(); + ?> +
MSSVHọ tênKỳĐăng ký
" . $row["MSSV"] . "" . $row["HoTen"] . "" . $row["Ky"] . "" . $row["TenMH"] . "
Không có dữ liệu
\ No newline at end of file From b5507e0c622e07d08a8a0a10bba6b998c034c174 Mon Sep 17 00:00:00 2001 From: hungdm Date: Fri, 26 Apr 2024 21:28:06 +0700 Subject: [PATCH 3/3] update database student --- database/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/index.php b/database/index.php index 6e2b36cf5..f31d6a20e 100644 --- a/database/index.php +++ b/database/index.php @@ -27,7 +27,7 @@ $conn = new mysqli($server, $user, $pass, $database); // Kiểm tra kết nối if ($conn->connect_error) { - die("Kết nối CSDL thất bại: " . $connect->connect_error); + die("Kết nối CSDL thất bại: " . $conn->connect_error); } $sql = "SELECT sinhvien.MSSV, sinhvien.HoTen, monhoc.MaMH, monhoc.TenMH, dangky.Ky FROM dangky