|
 |
|
รบกวนพี่ๆ ช่วยดู code เกี่ยวกับการแสดงผลน่อยครับ ไม่ยอมเรียงลำดับให้ครับ |
|
 |
|
|
 |
 |
|
ไม่เรียง1,2,3, ให้ครับ


Code (PHP)
<?php
$menu = "person";
?>
<?php include("../condb.php"); ?>
<?php include("header.php"); ?>
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
<h1><i class="nav-icon fas fa-address-card"></i> จัดการข้อมูลบุคลากร </h1>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="card">
<div class="card-header card-navy card-outline">
<div align="right">
<a href="add.php">
<button type="button" class="btn btn-success btn-xs" data-toggle="modal" data-target="#exampleModal"><i class="fa fa-user-plus"></i> เพิ่มข้อมูล บุคลากร</button></a>
</div>
</div>
<br>
<div class="card-body p-1">
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-12">
<table id="example1" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
<thead>
<tr role="row" class="info">
<th tabindex="0" rowspan="1" colspan="1" style="width: 7%;">ลำดับ</th>
<th tabindex="0" rowspan="1" colspan="1" style="width: 15%;">รหัสบุคลากร</th>
<th tabindex="0" rowspan="1" colspan="1" style="width: 15%;">ชื่อ-นามสกุล</th>
<th tabindex="0" rowspan="1" colspan="1" style="width: 15%;">อาจารย์ประจำ</th>
<th tabindex="0" rowspan="1" colspan="1" style="width: 10%;">-</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM person as p
INNER JOIN Major as m ON p.Major=m.Major
ORDER BY PersonID ASC" or die("Error:" . mysqli_error());
//3.เก็บข้อมูลที่ query ออกมาไว้ในตัวแปร result .
$result = mysqli_query($con, $query);
while($row = mysqli_fetch_array($result)) {
$i=$i+1;
echo "<tr>";
echo "<td>No." .$i . "</td> ";
echo "<td>" .$row["Username"] . "</td> ";
echo "<td>" .$row["FirstName"] . $row["LastName"]. "</td> ";
echo "<td>" .$row["Major_name"] . "</td> ";
echo "<td><a class='btn btn-info btn-xs' href='view.php?act=edit&ID=$row[0]'>
<i class='fas fa-eye'>
</i>
</a>
<a class='btn btn-warning btn-xs' href='edit.php?act=edit&ID=$row[0]'>
<i class='fas fa-pencil-alt'>
</i>
</a>
<a class='btn btn-danger btn-xs' href='del.php?ID=$row[0]'onclick=\"return confirm('คุณต้องการลบข้อมูลใช่มั้ย')\">
<i class='fas fa-trash-alt'>
</i>
</a>
</td> ";
}
//5. close connection
mysqli_close($con);
?>
</tbody>
</table>
</div>
<div class="col-md-1" >
</div>
</div>
</div>
</div>
</div>
<!-- /.col -->
</div>
</section>
<!-- /.content -->
<?php include('footer.php'); ?>
<script>
$(function () {
$(".datatable").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
http://fordev22.com/
"ordering": true,
"info": true,
"autoWidth": false,
});
});
</script>
</body>
</html>
Tag : PHP, MySQL, HTML, HTML5, Appserv, Windows

|
ประวัติการแก้ไข 2021-11-13 21:22:11
|
 |
 |
 |
 |
Date :
2021-11-13 21:18:02 |
By :
tossapon8 |
View :
581 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

ยังเป็นเหมือนเดิมอยู่ครับผม

|
 |
 |
 |
 |
Date :
2021-11-13 22:10:37 |
By :
tossapon8 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|