001.
<?php
002.
$menu
=
"person"
;
003.
?>
004.
<?php
include
(
"../condb.php"
); ?>
005.
<?php
include
(
"header.php"
); ?>
006.
<!-- Content Header (Page header) -->
007.
<section
class
=
"content-header"
>
008.
<div
class
=
"container-fluid"
>
009.
<h1><i
class
=
"nav-icon fas fa-address-card"
></i> จัดการข้อมูลบุคลากร </h1>
010.
</div><!-- /.container-fluid -->
011.
</section>
012.
<!-- Main content -->
013.
<section
class
=
"content"
>
014.
015.
016.
017.
<div
class
=
"card"
>
018.
<div
class
=
"card-header card-navy card-outline"
>
019.
020.
021.
<div align=
"right"
>
022.
<a href=
"add.php"
>
023.
<button type=
"button"
class
=
"btn btn-success btn-xs"
data-toggle=
"modal"
data-target=
"#exampleModal"
><i
class
=
"fa fa-user-plus"
></i> เพิ่มข้อมูล บุคลากร</button></a>
024.
025.
</div>
026.
</div>
027.
<br>
028.
<div
class
=
"card-body p-1"
>
029.
<div
class
=
"row"
>
030.
<div
class
=
"col-md-1"
>
031.
032.
</div>
033.
<div
class
=
"col-md-12"
>
034.
<table id=
"example1"
class
=
"table table-bordered table-striped dataTable"
role=
"grid"
aria-describedby=
"example1_info"
>
035.
<thead>
036.
<tr role=
"row"
class
=
"info"
>
037.
<th tabindex=
"0"
rowspan=
"1"
colspan=
"1"
style=
"width: 7%;"
>ลำดับ</th>
038.
<th tabindex=
"0"
rowspan=
"1"
colspan=
"1"
style=
"width: 15%;"
>รหัสบุคลากร</th>
039.
<th tabindex=
"0"
rowspan=
"1"
colspan=
"1"
style=
"width: 15%;"
>ชื่อ-นามสกุล</th>
040.
<th tabindex=
"0"
rowspan=
"1"
colspan=
"1"
style=
"width: 15%;"
>อาจารย์ประจำ</th>
041.
<th tabindex=
"0"
rowspan=
"1"
colspan=
"1"
style=
"width: 10%;"
>-</th>
042.
043.
</tr>
044.
</thead>
045.
<tbody>
046.
<?php
047.
$query
= "SELECT * FROM person
as
p
048.
INNER JOIN Major
as
m ON p.Major=m.Major
049.
ORDER BY PersonID ASC
" or die("
Error:" . mysqli_error());
050.
051.
$result
= mysqli_query(
$con
,
$query
);
052.
while
(
$row
= mysqli_fetch_array(
$result
)) {
053.
$i
=
$i
+1;
054.
echo
"<tr>"
;
055.
echo
"<td>No."
.
$i
.
"</td> "
;
056.
echo
"<td>"
.
$row
[
"Username"
] .
"</td> "
;
057.
echo
"<td>"
.
$row
[
"FirstName"
] .
$row
[
"LastName"
].
"</td> "
;
058.
echo
"<td>"
.
$row
[
"Major_name"
] .
"</td> "
;
059.
echo
"<td><a
class
=
'btn btn-info btn-xs'
href=
'view.php?act=edit&ID=$row[0]'
>
060.
<i
class
=
'fas fa-eye'
>
061.
</i>
062.
</a>
063.
<a
class
=
'btn btn-warning btn-xs'
href=
'edit.php?act=edit&ID=$row[0]'
>
064.
<i
class
=
'fas fa-pencil-alt'
>
065.
</i>
066.
</a>
067.
<a
class
=
'btn btn-danger btn-xs'
href=
'del.php?ID=$row[0]'
onclick=\
"return confirm('คุณต้องการลบข้อมูลใช่มั้ย')\"
>
068.
<i
class
=
'fas fa-trash-alt'
>
069.
</i>
070.
</a>
071.
</td> ";
072.
}
073.
074.
mysqli_close(
$con
);
075.
076.
?>
077.
078.
079.
080.
</tbody>
081.
</table>
082.
083.
</div>
084.
<div
class
=
"col-md-1"
>
085.
086.
</div>
087.
</div>
088.
</div>
089.
090.
</div>
091.
092.
093.
094.
</div>
095.
<!-- /.col -->
096.
</div>
097.
</section>
098.
<!-- /.content -->
099.
<?php
include
(
'footer.php'
); ?>
100.
<script>
101.
$(
function
() {
102.
$(
".datatable"
).DataTable();
103.
$(
'#example2'
).DataTable({
104.
"paging"
: true,
105.
"lengthChange"
: false,
106.
"searching"
: false,
107.
http:
108.
"ordering"
: true,
109.
"info"
: true,
110.
"autoWidth"
: false,
111.
});
112.
});
113.
</script>
114.
</body>
115.
</html>