<?php
include_once "library/inc.connection.php";
	include_once "library/inc.library.php";
$id_user = $_GET['id_user'];
$id_gejala = $_GET['id_gejala'];
$id_penyakit = $_GET['id_penyakit'];
$id_solusi = $_GET['id_solusi'];
switch($_GET[action]) {
		case "hapus_user";
		$get = "delete from user where id_user = '$id_user'";
		$del = mysql_query ($get);
		if($del){
			header('location: tabel_user.php');
			exit();
		}
		else {
			header('location: tabel_user.php');
		exit();
		}
		break;
		
case "hapus_gejala";
		$get = "delete from gejala where id_gejala = '$id_gejala'";
		$del = mysql_query ($get);
		if($del){
			header('location: tabel_gejala.php');
			exit();
		}
		else {
			header('location: tabel_gejala.php');
		exit();
		}
		break;
		
case "hapus_penyakit";
		$get = "delete from penyakit where id_penyakit = '$id_penyakit'";
		$del = mysql_query ($get);
		$query2 = mysql_query("SELECT count(id_penyakit) as jumlah FROM penyakit");
			while ($row = mysql_fetch_array($query2) ) 
			{
			$jumlah=$row['jumlah'];
			$probabiliti=1/$jumlah;
			$update = mysql_query("update penyakit set np_populasi='$probabiliti'");
			}
		if($del){
			header('location: tabel_penyakit.php');
			exit();
		}
		else {
			header('location: tabel_penyakit.php');
		exit();
		}
		break;
		
case "hapus_solusi";
		$get = "delete from solusi where id_solusi = '$id_solusi'";
		$del = mysql_query ($get);
		if($del){
			header('location: tabel_solusi.php');
			exit();
		}
		else {
			header('location: tabel_solusi.php');
		exit();
		}
		break;
		
		}
?>