/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
ajax
/
setting_law
/
up file
home
<?php use function PHPSTORM_META\type; session_start(); include('../../../config/main_function.php'); $secure = "cAh3DrJACzw4RbU"; $connection = connectDB($secure); $status = mysqli_real_escape_string($connection, $_POST['status']); $sql = "SELECT * FROM tbl_law WHERE active_status = '$status' ORDER BY announce_date DESC"; $res = mysqli_query($connection, $sql) or die($connection->error); // $sql = "SELECT * FROM tbl_law_doc WHERE column"; // $res = mysqli_query($connection, $sql) or die($connection->error); // $rows = mysqli_fetch_all($res,MYSQLI_ASSOC); ?> <style> </style> <div class="table-responsive"> <table class="table table-striped dataTables-example table-bordered"> <thead> <tr> <th style="width: 30%;">หัวข้อกฎหมาย</th> <th>รายละเอียด</th> <th style="width: 10%;">สถานะ</th> <th style="width: 10%;">จัดการ</th> </tr> </thead> <tbody> <?php $i = 1; while ($row = mysqli_fetch_assoc($res)) { $sql_count = "SELECT COUNT(*) AS allfiles FROM tbl_law_document WHERE law_id = '{$row['law_id']}'"; $res_count = mysqli_query($connection, $sql_count) or die($connection->error); $row_count = mysqli_fetch_assoc($res_count); $count_file = $row_count['allfiles']; ?> <tr id="tr_<?php echo $row['law_id']; ?>"> <td> <?php echo $row['law_title']; ?><br> วันที่โพส : <?php echo date("d/m/Y",strtotime($row['announce_date'])); ?> </td> <td> <?php echo ($row['law_description'] != '') ? '<p>'.$row['law_description'].'</p>' : ""; ?> <?php echo ($row['law_link'] != '') ? "<p><a href='" . $row['law_link'] . "' target='_blank'>" . $row['law_link'] . "</a></p>" : "" ?> </td> <td> <button class="btn btn-xs w-100 <?php echo ($row['active_status'] == 1) ? 'btn-primary' : 'btn-danger'; ?>" onclick="ChangeStatus(this,'<?php echo $row['law_id']; ?>')"> <?php echo ($row['active_status'] == 1) ? 'ใช้งาน' : 'ไม่ใช้งาน'; ?> </button> </td> <td> <button class="btn btn-warning btn-xs w-100 mb-2" onclick="GetModalEdit('<?php echo $row['law_id']; ?>')">แก้ไข</button> <button class="btn btn-danger btn-xs w-100 mb-2" onclick="Delete('<?php echo $row['law_id']; ?>')">ลบ</button> </td> </tr> <?php $i++; } ?> </tbody> </table> </div>