<?php

include_once "library/inc.connection.php";
include_once "library/inc.library.php";

// Baca Jam pada Komputer
date_default_timezone_set("Asia/Jakarta");
$sql= mysql_query("SELECT * from aturan");
	while ($dt = mysql_fetch_array($sql))
	{
	$id_aturan=$dt['id_aturan'];
	$sql2= mysql_query("SELECT count(id_gejala) as jumlah from aturan where id_gejala='$dt[id_gejala]'");
	$dt2 = mysql_fetch_array($sql2);
	$sql3= mysql_query("SELECT * from penyakit where id_penyakit='$dt[id_penyakit]'");
	$dt3 = mysql_fetch_array($sql3);
	$np_populasi=$dt3['np_populasi'];
	$jumlah=$dt2['jumlah'];
	$probabiliti=$np_populasi/$jumlah;
	echo "$dt[id_gejala]=$dt3[np_populasi]/$dt2[jumlah]=$probabiliti<br>";
	$update = mysql_query("update aturan set nilai_probabilitas='$probabiliti' where id_aturan='$id_aturan'");

if ($update) {
   header('Location: tabel_aturan.php');
} else {
   // header('Location: tabel_aturan.php');
	}
	}
?>