<?php require_once'conn.php'; include 'header.php'; ?> <meta charset="UTF-8"> <title>ทะเบียนครุภัณฑ์</title> <?php $perpage = 30; if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $start = ($page - 1) * $perpage; ?> <div class="row"> <ul class="nav nav-tabs"> <li><a href="admin.php" style="background-color: #ccc">การแจ้งซ่อมครุภัณฑ์</a></li> <li class="active"><a href="item_list.php">ทะเบียนครุภัณฑ์</a></li> </ul><br> <div class="col-md-12"> <h3><i class="glyphicon glyphicon-tasks"></i> ทะเบียนครุภัณฑ์ </h3><hr> </div> <div class="row" align="right"> <div class="col-md-4"> <form name="search" method="post" action="item_list.php"> <div class="input-group"> <input type="text" name="txtkeyword" class="form-control" placeholder="กรุณากรอกเลขครุภัณฑ์ที่ต้องการค้นหา..."> <div class="input-group-btn"> <button class="btn btn-success" type="submit"> <i class="glyphicon glyphicon-search"></i> ค้นหา </button> </div> </div> </form> <?php ?> </div> <div class="col-md-8" align="right"> <a href="item_add.php"> <button type="button" class="btn btn-primary"> <i class="glyphicon glyphicon-plus"></i> เพิ่มอุปกรณ์ </button> </a><br> </div> </div><br> <div class=""> <table class="table table-bordered table-striped"> <thead> <tr class="bg-info"> <th><p align="center">ลำดับ</p></th> <th><p align="center">เลขครุภัณฑ์</p></th> <th><p align="center">ชื่อครุภัณฑ์</p></th> <th><p align="center">ชื่อหน่วยงาน</p></th> <th><p align="center">สถานะการใช้งาน</p></th> <th><p align="center">ประวัติการซ่อม</p></th> <th><p align="center">รายละเอียด</p></th> </tr> </thead> <?php $search = isset($_POST['txtkeyword']) ? $_POST['txtkeyword'] : ''; $sql = "SELECT * FROM durable_articles " . "INNER JOIN department ON durable_articles.department_id = department.department_id " . "WHERE `k_id` LIKE '%$search%' limit {$start} , {$perpage} "; $result = mysqli_query($con, $sql) or die(mysql_error()); $i=1; while ($fetch = mysqli_fetch_assoc($result)) { ?> <tr> <td align="center"> <?php echo $i; ?> </td> <td align="center"> <?php echo $fetch['k_id']; ?> </td> <td align="center"> <?php echo $fetch['k_name']; ?> </td> <td align="center"> <?php echo $fetch['department_name']; ?> </td> <td align="center"> <?php echo $fetch['k_status']; ?> </td> <td align="center"> <a href="item_history.php?id=<?php echo $fetch['k_id']; ?>"> <button type="button" class="btn btn-default "> <i class="glyphicon glyphicon-wrench"></i> </button> </a> </td> <td align="center"> <a href="item_detail.php?id=<?php echo $fetch['k_id']; ?>"> <button type="button" class="btn btn-info"> <i class="glyphicon glyphicon-new-window"></i> </button> </a> </td> </tr> <?php $i++;} ?> </table> <?php $sql2 = "SELECT * FROM durable_articles "; $query2 = mysqli_query($con, $sql2); $total_record = mysqli_num_rows($query2); $total_page = ceil($total_record / $perpage); ?> </div> <div class="text-center"> <nav aria-label="Page navigation"> <ul class="pagination"> <li> <a href="item_list.php?page=1" aria-label="Previous"> <span aria-hidden="true">«</span> </a> </li> <?php for ($i = 1; $i <= $total_page; $i++) { ?> <li><a href="item_list.php?page=<?php echo $i; ?>"><?php echo $i; ?></a></li> <?php } ?> <li> <a href="item_list.php?page=<?php echo $total_page; ?>" aria-label="Next"> <span aria-hidden="true">»</span> </a> </li> </ul> </nav> รวมทั้งหมด <span class="badge"><?php echo $total_record; ?></span> รายการ </div> </div> <?php include 'footer.php';
$sql = "SELECT * FROM durable_articles " . "LEFT JOIN department ON (durable_articles.department_id = department.department_id) " . "ORDER BY k_id LIKE '%$search%' limit {$start} , {$perpage} ";
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง