Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68414 Members, 793 Products, 5353 Topic, 13045 Comments)

CRUD hapus tidak jalan - Mohon koreksinya dong

Dibuat
Login Terakhir 9 Jam lalu,
Telah Dilihat 1296 Kali
Rafisqy Adhideva Mengatakan : Sultan Account
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2. Mastah2 sekalian mohon koreksinya dong, perintah crud sy kok gk jalan ya...data ditampilan gk kehapus...mohon pencerahannya...
  3.  
  4. 1. php detail tampilan sbb :
  5.  
  6. <?php
  7. include("sess_check.php");
  8.  
  9. // deskripsi halaman
  10. $pagedesc = "Menunggu Approval";
  11. include("layout_top.php");
  12. include("dist/function/format_tanggal.php");
  13. include("dist/function/format_rupiah.php");
  14. $id = $sess_pegawaiid;
  15. ?>
  16. <!-- top of file -->
  17. <!-- Page Content -->
  18. <div id="page-wrapper">
  19. <div class="container-fluid">
  20. <div class="row">
  21. <div class="col-lg-12">
  22. <h1 class="page-header">Data Cuti Menunggu Approval</h1>
  23. </div><!-- /.col-lg-12 -->
  24. </div><!-- /.row -->
  25.  
  26. <div class="row">
  27. <div class="col-lg-12"><?php include("layout_alert.php"); ?></div>
  28. </div>
  29.  
  30. <div class="row">
  31. <div class="col-lg-12">
  32. <div class="panel panel-default">
  33. <div class="panel-body">
  34. <?php
  35. $Sql = "SELECT cuti.*, employee.* FROM cuti, employee WHERE cuti.npp=employee.npp AND cuti.stt_cuti !='Rejected'
  36. AND cuti.npp='$id' ORDER BY cuti.tgl_pengajuan DESC";
  37. $Qry = mysqli_query($conn, $Sql);
  38.  
  39. ?>
  40. <table class="table table-striped table-bordered table-hover" id="tabel-data">
  41. <thead>
  42. <tr>
  43. <th width="1%">No</th>
  44. <th width="10%">No Cuti</th>
  45. <th width="5%">Tgl Pengajuan</th>
  46. <th width="5%">Tgl Awal</th>
  47. <th width="5%">Tgl Akhir</th>
  48. <th width="5%">Status</th>
  49. <th width="5%">Opsi</th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. <?php
  54. $i=1;
  55. while($data = mysqli_fetch_array($Qry)){
  56. echo '<tr>';
  57. echo '<td class="text-center">'. $i .'</td>';
  58. echo '<td class="text-center">'. $data['no_cuti'] .'</td>';
  59. echo '<td class="text-center">'. IndonesiaTgl($data['tgl_pengajuan']) .'</td>';
  60. echo '<td class="text-center">'. IndonesiaTgl($data['tgl_awal']) .'</td>';
  61. echo '<td class="text-center">'. IndonesiaTgl($data['tgl_akhir']) .'</td>';
  62. echo '<td class="text-center">'. $data['stt_cuti'] .'</td>';
  63. echo '<td class="text-center">
  64. <a href="#myModal" data-toggle="modal" data-load-code="'.$data['no_cuti'].'" data-remote-target="#myModal .modal-body" class="btn btn-primary btn-xs">Detail</a>';?>
  65. <a href="cuti_hapus.php?no=<?php echo $data['no_cuti'];?>" onclick="return confirm('Apakah anda yakin akan membatalkan pengajuan cuti No. <?php echo $data['no_cuti'];?>?');" class="btn btn-danger btn-xs">Hapus</a></td>
  66. <?php
  67. echo '</td>';
  68. echo '</tr>';
  69. $i++;
  70. }
  71. ?>
  72. </tbody>
  73. </table>
  74. </div>
  75. <!-- Large modal -->
  76. <div class="modal fade bs-example-modal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
  77. <div class="modal-dialog modal-lg">
  78. <div class="modal-content">
  79. <div class="modal-body">
  80. <p>Sedang memproses…</p>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div><!-- /.panel -->
  86. </div><!-- /.col-lg-12 -->
  87. </div><!-- /.row -->
  88. </div><!-- /.container-fluid -->
  89. </div><!-- /#page-wrapper -->
  90. <!-- bottom of file -->
  91. <script type="text/javascript">
  92. $(document).ready(function() {
  93. $('#tabel-data').DataTable({
  94. "responsive": true,
  95. "processing": true,
  96. "columnDefs": [
  97. { "orderable": false, "targets": [] }
  98. ]
  99. });
  100.  
  101. $('#tabel-data').parent().addClass("table-responsive");
  102. });
  103. </script>
  104. <script>
  105. var app = {
  106. code: '0'
  107. };
  108.  
  109. $('[data-load-code]').on('click',function(e) {
  110. e.preventDefault();
  111. var $this = $(this);
  112. var code = $this.data('load-code');
  113. if(code) {
  114. $($this.data('remote-target')).load('cuti_detail.php?code='+code);
  115. app.code = code;
  116.  
  117. }
  118. });
  119.  
  120. </script>
  121. <?php
  122. include("layout_bottom.php");
  123. ?>
  124.  
  125. 2. CRUD aplikasinya
  126.  
  127. <?php
  128. include("sess_check.php");
  129. $id = $_GET['no_cuti'];
  130. $sql = "DELETE FROM cuti, employee WHERE cuti.npp=employee.npp AND cuti.no_cuti='". $id ."'";
  131. $ress = mysqli_query($conn, $sql);
  132. header("location: cuti_waitapp.php?act=delete&msg=success");
  133. ?>
  134.  
  135. Mohon bantuan mastah2 sekalian ya? Terima kasih sebelumnya...
  136. Wassalam...

Ada 2 Jawaban

Hardiansyah
commented on 18 Apr 2020 04:38:03
Salah satu jawaban terbaik,..
  1. Assalamualaikum,.. $id = $_GET['no_cuti']; diganti menjadi $id = $_GET['no'];
Rafisqy Adhideva
commented on 19 Apr 2020 01:32:28
  1. Assalamualaikum,..
  2. Terima kasih mas @hardiansyah...udah bisa jalan mas...
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online