<?php
include "config.php"; 
include "header.php";
echo "<tr>";
echo "<td width=\"250\" valign=\"top\">";

include "left.php";

echo "</td>";
echo "<td width=\"4\" bgcolor=\"#CCCCCC\">&nbsp;</td>";
echo "<td width=\"550\" height=\"320\" align=\"left\" valign=\"top\"><h3 align=\"left\" class=\"pagesect judul_besar\"> &nbsp;<span class=\"menu1\">&nbsp;&nbsp;Sistem Pakar Gangguan Perkembangan pada Anak</span></h3>";
echo "<p class=\"pagesect judul_besar\">";
echo "<blockquote>";
										
	if(!pasien()) {
	echo "<div align=\"center\"><span class=menu>Access Denied !!!</span></div>";
	} else {

$kosongkan_konsul = mysql_query("delete from konsultasi");
//untuk menghitung jumlah gejala yang diinputkan
$cek=0;
while($gejala[$cek])			// men-set $cek dengan gejala yang dimasukan di halaman konsultasi
{
$gejalake[]=$gejala[$cek];    	//  menyimpan gejala dalam array $gejalake 
$cek++;
}
// jika tidak ada gejala yang dimasukan
if ($cek==0)					
	{
	echo "<script language=javascript>alert ('Gejala Belum Diisi !!');history.back();</script>";
	}
//perhitungan untuk hanya 1 gejala yang di klik
else if($cek==1) 							
	{
	//untuk gejala pertama yang diklik
	$ambil1 ="select * from gejala,pengetahuan,gangguan where gejala.id_gejala=pengetahuan.id_gejala and gangguan.id_gangguan=pengetahuan.id_gangguan and pengetahuan.id_gejala='$gejala[0]'";		
	$query1 =mysql_query($ambil1);
	$cek2 = mysql_num_rows($query1);
		//jika jumlah data yang dihasilkan dari (tabel pengetahuan) query tidak ada atau kosong / =0
		if($cek2==0)  						
			{
				echo "<div align=\"center\"><span class=baca>Pengetahuan Tentang gejala belum didefinisikan..</div></span>";
				echo"<div align=\"center\"><span class=baca>Untuk Kembali,<span class=isi><a href=\"javascript:history.back()\">&nbsp;back..</a></div></span>";
			}
				else
			{ 
		//	echo "<table align=left>";
			echo "<div align=\"left\" class=judul2><img src=\"images/konsul.png\" />&nbsp;Hasil Diagnosa Gangguan Perkembangan Anak</div>";
												
			$perintah=mysql_query("select gejala from gejala where id_gejala='$gejala[0]'");
			$row1=mysql_fetch_array($perintah);

	
			$nama=$row1[gejala];
			echo "<span class=menu2>Gejala yang Terlihat : </span><br>";
			echo "<span class=baca>&bull;&nbsp;",$nama,"</span><br><br>";
			echo "<span class=menu2>Mengalami Gangguan :&nbsp;";
			while ($row2=mysql_fetch_array($query1)) 
					{
						$gangguan=$row2[jenis_gangguan];				
						$id_gangguan=$row2[id_gangguan];
						$id_gejala=$row2[id_gejala];
						$MB=$row2[mb];
						$MD=$row2[md];
		
						$hasilCF=$MB-$MD;
					
						$laksanakan= mysql_query("insert into konsultasi (id_gejala,id_gangguan,mb,md,cf) 
						values ('$row2[id_gejala]','$row2[id_gangguan]','$row2[mb]','$row2[md]','$hasilCF')");

		
						echo"<br>";
						echo "<span class=baca>
						<a href=\"detail_gangguan.php?id=$id_gangguan\">&bull;&nbsp;$gangguan</a></span>
						<span class=isi2>&nbsp;-- Nilai Kepercayaan &nbsp; : </span> <span class=baca>$hasilCF </span>
						";
					}
		}    
}
else 			//apabila lebih dari 1 gejala yang diklik atau dimasukkan
{	
			echo "<div align=\"left\" class=judul2><img src=\"images/konsul.png\" />&nbsp;Hasil Diagnosa Gangguan Perkembangan Anak</div><br>";
			echo "<span class=menu2>Gejala yang Terlihat : </span><br>";
		//perulangan untuk melihat daftar gejala		
		for ($m=0;$m<=$cek; $m++)
				{					
					$perintah2="select*from gejala where id_gejala='$gejala[$m]'";
					$query2=mysql_query($perintah2);
					//Perulangan mengambil pengetahuan berdasarkan gejala yang dipilih
					while ($row2=mysql_fetch_array($query2))
						{
						echo "<span class=baca>&bull;&nbsp;",$row2[gejala],"</span><br>";
						$pilih_peng2 = mysql_query("select * from pengetahuan where id_gejala='$row2[id_gejala]'");
							//Perulangan menyimpan pengetahuan kedalam tabel Konsultasi
							while ($hasil_pilih2= mysql_fetch_array($pilih_peng2))
							{
							$masuk_konst2= mysql_query("insert into konsultasi (id_gejala,id_gangguan,mb,md) 
							values ('$row2[id_gejala]','$hasil_pilih2[id_gangguan]','$hasil_pilih2[mb]','$hasil_pilih2[md]')");
							}
						}
				}
		//Distinct id_gangguan dari tabel konsultasi 
		$pilih=mysql_query("select DISTINCT(id_gangguan) from konsultasi");
		//Perulangan mengambil id_gangguan dari tabel konsultasi yang telah di DISTINCT	

		while ($baris = mysql_fetch_array($pilih))
			{
					$pilih2=mysql_query("select * from konsultasi where id_gangguan='$baris[id_gangguan]'");
					//hitung baris yang ada pada ib_gangguan yang sama
					$hitung=mysql_num_rows($pilih2);
					
					if($hitung>1)
					{
						while ($baris2 = mysql_fetch_array($pilih2))
						{			
							//---------------------------------------------------------//
							$mb_lama=$mb_sementara;
							$mb_baru="$baris2[mb]";
							$mb_sementara = ($mb_lama + $mb_baru) * (1 - $mb_lama);
							//---------------------------------------------------------//	
							$md_lama=$md_sementara;
							$md_baru="$baris2[md]";
							$md_sementara = ($md_lama + $md_baru) * (1 - $md_lama);
							//---------------------------------------------------------//
						}
							$nilai_cf=$mb_sementara-$md_sementara;
							//set nilai MB dan MD sementara menjadi 0
							$mb_sementara=0;
							$md_sementara=0;
					}
					else if($hitung=1)
					{
						$baris2 = mysql_fetch_array($pilih2);
							//----------------------------------------------------------//
							$nilai_mb="$baris2[mb]";
							$nilai_md="$baris2[md]";
							$nilai_cf=$nilai_mb-$nilai_md;
							//----------------------------------------------------------//
					}					
				$ubah_nilai = "update konsultasi set cf='$nilai_cf' where id_gangguan='$baris[id_gangguan]'";
				$ubah =mysql_query($ubah_nilai);
			}
			//Untuk Menampilkan Hasil
			echo "<br><span class=menu2>Kemungkinan Mengalami Gangguan : </span><br>";					
			$ambil5 ="select distinct(konsultasi.id_gangguan),(konsultasi.cf),(gangguan.jenis_gangguan) from konsultasi,
					  gangguan where gangguan.id_gangguan=konsultasi.id_gangguan order by cf desc";		
			$query5 =mysql_query($ambil5);
			while ($ttampil = mysql_fetch_array($query5))
			{	
				echo "
				<span class=baca>
				<a href=\"detail_gangguan.php?id=$ttampil[id_gangguan]\">&bull;&nbsp;$ttampil[jenis_gangguan]</a></span>
				<span class=isi2>-- Nilai Kepercayaan &nbsp; : </span> <span class=baca>$ttampil[cf] </span><br>
				";
			}		
}
}
include "footer.php";
?>

Welcome,

Try to convert php code to jsp and if you run into problems and want to ask for help here.

Please read:
1. member rules and
2. homework policy at daniweb.

Do you want us to convert that!?!? You must be out of your mind. Do you even know java?
You need to know java and have some understanding in php.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.