/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
ajax
/
setting_faq
/
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_faq WHERE active_status = '$status'"; $res = mysqli_query($connection, $sql) or die($connection->error); ?> <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)) { ?> <tr id="tr_<?php echo $row['faq_id']; ?>"> <td> <?php echo $row['faq_question']; ?> </td> <td> <?php echo ($row['faq_answer'] != '') ? '<p>'.$row['faq_answer'].'</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['faq_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['faq_id']; ?>')">แก้ไข</button> <button class="btn btn-danger btn-xs w-100 mb-2" onclick="Delete('<?php echo $row['faq_id']; ?>')">ลบ</button> </td> </tr> <?php $i++; } ?> </tbody> </table> </div>