Delete Data 3 Tabel tidak bisa

Raul Ananda Putra · Aug 3, 2017
[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.
<?php
		if ($_GET[mode]=="hapus"){
			$xx = getData("id_reg","tb_medik","id_reg='$_GET[id]'");
			if (!$xx[0]==""){
				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]'");
				echo "<script>
					 		notifsukses('Success,'Data Telah Dihapus..!!');
					  		setTimeout('window.location.href=\"media.php?page=$page\"', 2000)
					   </script>";
			}else{
				echo "<script>window.location=('media.php?page=$page')</script>";
			}
		}
?>

<div class="table-header">
	    DATA REKAM MEDIK
	</div>
	<div class="row-fluid">
	<table id="myTable" class="table table-striped table-bordered table-hover">
	<thead>
	    <tr>
	    <th class="center" width="35px">No</th>
	    <th class="center" width="90px">No. Registrasi</th>
	    <th class="hidden-480 center">Nama Pasien</th>	    
	    <th class="center" width="100px">Tanggal</th>
	    <th class="hidden-480 center">Nama Dokter</th>
	    <th class="hidden-480 center">Poliklinik</th>
	    <th class="hidden-480 center">Diagnosa</th>
	    <th class="center" width="100px">Pembayaran</th>
	    <th class="hidden-480 center" width="40px">Aksi</th>
	    </tr>
	</thead>
	<tbody>
	 <?php
	 	$qry = mysql_query("SELECT a.*, b.nm_pasien, c.nm_dokter FROM tb_medik a 
					 		LEFT JOIN tb_pasien b ON a.id_pasien=b.id_pasien 
					 		LEFT JOIN m_dokter c ON a.id_dokter=c.id_dokter 
					 		ORDER BY a.id_reg DESC");
		while ($d = mysql_fetch_array($qry)){
		$tgl = getTglIndo($d[tgl_reg]);
		
		    $cSP = getNumRows("SELECT * FROM tb_medik WHERE diagnosa !=0");
		    $spAlert = array(
	      		"0"=>"<a href='?page=$page&act=resep&id=$d[id_reg]'>
	      				<button class='btn btn-mini btn-success' class='tooltip-info' data-rel='tooltip' data-original-title='Resep'>
    		               <span class='white'> <i class='icon-leaf bigger-120'></i> </span>
            	        </button>
            	      </a>",
	      		"1"=>"".$d['diagnosa']."</span>"
	      	);
	      	$aSP = ($cSP>0 ? $spAlert["1"] : $spAlert["0"]);

		    $pRS = getNumRows("SELECT * FROM tb_medik WHERE jasa !=0");
		    $psAlert = array(
	      		"0"=>"<a href='?page=$page&act=bayar&id=$d[id_reg]'>
	      				<button class='btn btn-mini btn-info' class='tooltip-success' data-rel='tooltip' data-original-title='Bayar'>
                   			<span class='white'>&nbsp;<i class='icon-dollar bigger-120'></i>&nbsp;</span>
                   		</button>
                   	  </a>",
	      		"1"=>"".rupiah($d['jasa'])."</span>"
	      	);
	      	$pCS = ($pRS>0 ? $psAlert["1"] : $psAlert["0"]);
	      
	      ?>
	      <tr>
	      <?php
	      $no++;
	      echo "	      
	      <td class='center'>$no</td>	      
	      <td class='center'>$d[id_reg]</td>
	      <td class='center'>$d[nm_pasien]</td>
	      <td class='center'>$tgl</td>
	      <td class='center'>$d[nm_dokter]</td>
	      <td class='center'>$d[nm_poli]</td>
	      <td class='center'>$aSP</td>
	      <td class='center'>$pCS</td>
	      <td class='center'>
	            <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'>
                   <span class='red'><i class='icon-trash bigger-120'></i></span>
                   </button></a></td>";
	      ?>
	     </tr>
	    <?php 
	       }
	    ?>
	</tbody>
	</table>
	</div>
Silahkan login untuk menjawab!