| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/rytc/pta/ |
Upload File : |
<?php
@include('condb.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$search_query = $_POST['search'];
$sql = "SELECT * FROM pta_student,pta_dept WHERE s_name LIKE ? AND pta_student.s_dept = pta_dept.s_dept";
$stmt = $conn->prepare($sql);
$search_param = "%" . $search_query . "%";
$stmt->bind_param("s", $search_param);
$stmt->execute();
$result = $stmt->get_result();
}
?>
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ข้อมูลนักเรียน-นักศึกษา</title>
<link rel="stylesheet" href="css/insert.css">
<link rel="stylesheet" href="css/table.css">
<!-- Favicons -->
<link href="img/logo.png" rel="icon">
<link href="img/logo.png" rel="apple-touch-icon">
</head>
<body>
<header>
<?php @include('nav.php');?>
</header>
<div class="container">
<h1>ข้อมูลนักเรียน-นักศึกษา</h1>
<hr>
<table>
<thead>
<tr>
<th>คำนำหน้า</th>
<th>ชื่อ</th>
<th>ระดับชั้น</th>
<th>แผนกวิชา</th>
<th>แก้ไข</th>
<th>ลบ</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$p_id = $row['p_id'];
$s_id = $row['s_id'];
$s_prefix = $row['s_prefix'];
$s_name = $row['s_name'];
$s_level = $row['s_level'];
$s_level_text = "";
if($s_level=="1"){
$s_level_text="ปวช.1";
}
if($s_level=="2"){
$s_level_text="ปวช.2";
}
if($s_level=="3"){
$s_level_text="ปวช.3";
}
if($s_level=="4"){
$s_level_text="ปวส.1";
}
if($s_level=="5"){
$s_level_text="ปวส.2";
}
$s_dept = $row['s_dept'];
echo "<tr>
<td>" . $row["s_prefix"] . "</td>
<td>" . $row["s_name"] . "</td>
<td>" . $s_level_text . "</td>
<td>" . $row["d_name"] . "</td>
<td><a href='edit_student_data.php?id=".$row["s_id"]."'><button class='buttonA'>แก้ไข</button></a></td>
<td><a href='delete_student_data.php?id=".$row["s_id"]."'><button class='buttonB' onclick=\"return confirmAction('คุณต้องการลบข้อมูลนี้หรือไม่?');\">ลบ</button></a></td>
</tr>";
}
}
$stmt->close();
?>
<tr>
<td colspan=6>
<a href='insert_student.php?id=<?=$p_id;?>'><button>เพิ่มนักเรียน</button></a>
</td>
</tr>
</tbody>
</table>
</div>
<script>
function confirmAction(message) {
return confirm(message);
}
</script>
</body>
</html>
<?php
$conn->close();
?>