[ASK]
Sore mastah sekalian, ada yg mau saya tanyakan.
Saya tidak bisa delete data 3 Tabel sekaligus di page, namun query di jalankan di SQL bisa.
Mohon Pencerahan, please.
  1. <?php
  2. if ($_GET[mode]=="hapus"){
  3. $xx = getData("id_reg","tb_medik","id_reg='$_GET[id]'");
  4. if (!$xx[0]==""){
  5. mysql_query("DELETE tb_medik, tb_resep, tb_transaksi FROM tb_medik LEFT JOIN tb_resep ON tb_medik.id_reg=tb_resep.id_reg LEFT JOIN tb_transaksi ON tb_medik.id_reg=tb_transaksi.id_reg WHERE tb_medik.id_reg='$_GET[id]'");
  6. echo "<script>
  7. notifsukses('Success,'Data Telah Dihapus..!!');
  8. setTimeout('window.location.href=\"media.php?page=$page\"', 2000)
  9. </script>";
  10. }else{
  11. echo "<script>window.location=('media.php?page=$page')</script>";
  12. }
  13. }
  14. ?>
  15.  
  16. <div class="table-header">
  17. DATA REKAM MEDIK
  18. </div>
  19. <div class="row-fluid">
  20. <table id="myTable" class="table table-striped table-bordered table-hover">
  21. <thead>
  22. <tr>
  23. <th class="center" width="35px">No</th>
  24. <th class="center" width="90px">No. Registrasi</th>
  25. <th class="hidden-480 center">Nama Pasien</th>
  26. <th class="center" width="100px">Tanggal</th>
  27. <th class="hidden-480 center">Nama Dokter</th>
  28. <th class="hidden-480 center">Poliklinik</th>
  29. <th class="hidden-480 center">Diagnosa</th>
  30. <th class="center" width="100px">Pembayaran</th>
  31. <th class="hidden-480 center" width="40px">Aksi</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php
  36. $qry = mysql_query("SELECT a.*, b.nm_pasien, c.nm_dokter FROM tb_medik a
  37. LEFT JOIN tb_pasien b ON a.id_pasien=b.id_pasien
  38. LEFT JOIN m_dokter c ON a.id_dokter=c.id_dokter
  39. ORDER BY a.id_reg DESC");
  40. while ($d = mysql_fetch_array($qry)){
  41. $tgl = getTglIndo($d[tgl_reg]);
  42.  
  43. $cSP = getNumRows("SELECT * FROM tb_medik WHERE diagnosa !=0");
  44. $spAlert = array(
  45. "0"=>"<a href='?page=$page&act=resep&id=$d[id_reg]'>
  46. <button class='btn btn-mini btn-success' class='tooltip-info' data-rel='tooltip' data-original-title='Resep'>
  47. <span class='white'> <i class='icon-leaf bigger-120'></i> </span>
  48. </button>
  49. </a>",
  50. "1"=>"".$d['diagnosa']."</span>"
  51. );
  52. $aSP = ($cSP>0 ? $spAlert["1"] : $spAlert["0"]);
  53.  
  54. $pRS = getNumRows("SELECT * FROM tb_medik WHERE jasa !=0");
  55. $psAlert = array(
  56. "0"=>"<a href='?page=$page&act=bayar&id=$d[id_reg]'>
  57. <button class='btn btn-mini btn-info' class='tooltip-success' data-rel='tooltip' data-original-title='Bayar'>
  58. <span class='white'>&nbsp;<i class='icon-dollar bigger-120'></i>&nbsp;</span>
  59. </button>
  60. </a>",
  61. "1"=>"".rupiah($d['jasa'])."</span>"
  62. );
  63. $pCS = ($pRS>0 ? $psAlert["1"] : $psAlert["0"]);
  64.  
  65. ?>
  66. <tr>
  67. <?php
  68. $no++;
  69. echo "
  70. <td class='center'>$no</td>
  71. <td class='center'>$d[id_reg]</td>
  72. <td class='center'>$d[nm_pasien]</td>
  73. <td class='center'>$tgl</td>
  74. <td class='center'>$d[nm_dokter]</td>
  75. <td class='center'>$d[nm_poli]</td>
  76. <td class='center'>$aSP</td>
  77. <td class='center'>$pCS</td>
  78. <td class='center'>
  79. <a href='?page=$page&mode=hapus&id=$d[id_reg]'><button class='btn btn-mini btn-yellow' onclick='return qh();' class='tooltip-error' data-rel='tooltip' data-original-title='Hapus'>
  80. <span class='red'><i class='icon-trash bigger-120'></i></span>
  81. </button></a></td>";
  82. ?>
  83. </tr>
  84. <?php
  85. }
  86. ?>
  87. </tbody>
  88. </table>
  89. </div>
15090
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification