<link rel="stylesheet" type="text/css" href="../bootstrap4/css/bootstrap.min.css">
<?php
class dbhandaler
{
	public static $con;
	public static $conn;

	public static function dbconnect()
	{
		$host = "localhost";
		$user = "zwqcmlsz_sr_reporting";
		$password = "KBzFUWKsA79gNAHATEp4";
		$database= "zwqcmlsz_sr_reporting";
		$port = 3306;
		dbhandaler::$con =mysqli_connect($host,$user,$password,$database,$port);
		if(mysqli_connect_error()!=Null){echo "fail";}
	}

public static function selectcovid()
	{
		$ade=0;
		dbhandaler::dbconnect();
		$pselect = "select * from patient_data;";
		$pselectsql= mysqli_query(dbhandaler::$con,$pselect);
		{?>
		<table style="border: 1px solid black;" id="myatable"> 
		<?php 
		while ($pselecting=mysqli_fetch_assoc($pselectsql)) 
		{ $ade=1+$ade;?> 
	<tr> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Case_No']; ?> </td> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Age']; ?> </td> 
	<td width="100px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Gender']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Travel_History']; ?> </td> 
	<td width="400px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Treatment_Center']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Announce']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Current_Status']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['Township']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselecting['State']; ?> </td> 
	</tr>
		<?php } ?>
		</table> 
		<?php }
	}

	public static function selectcovidygn()
	{
		$aed=0;
		dbhandaler::dbconnect();
		$pselectygn = "select * from patient_data where State='Yangon';";
		$pselectsqlygn= mysqli_query(dbhandaler::$con,$pselectygn);
		{?>
		<table style="border: 1px solid black;" id="myatable"> 
		<?php 
		while ($ygn=mysqli_fetch_assoc($pselectsqlygn)) 
		{ $aed=1+$aed;?> 
	<tr> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Case_No']; ?> </td> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Age']; ?> </td> 
	<td width="100px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Gender']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Travel_History']; ?> </td> 
	<td width="400px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Treatment_Center']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Announce']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Current_Status']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $ygn['Township']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $ygn['State']; ?> </td> 
	</tr>
		<?php } ?>
		</table> 
		<?php }
	}

	public static function selectgender($sex)
	{
		dbhandaler::dbconnect();
		$selectgender= "select count(Gender) as gender from patient_data where Gender = '$sex';";
		$sqlselectgender= mysqli_query(dbhandaler::$con,$selectgender);
		while($arrow=mysqli_fetch_assoc($sqlselectgender)) 
		{
			return $arrow['gender'];
		}
	}

	public static function selectage1($sex)
	{
		dbhandaler::dbconnect();
		$selectage1= "select count(Age) as age1 from patient_data where Age < 15 and Gender in ($sex);";
		$sqlselectage1= mysqli_query(dbhandaler::$con,$selectage1);
		while($arrow=mysqli_fetch_assoc($sqlselectage1)) 
		{
			return $arrow['age1'];
		}
	}

	public static function selectage2($sex)
	{
		dbhandaler::dbconnect();
		$selectage2= "select count(Age) as age2 from patient_data where Age between 15 and 24 and Gender in ($sex);";
		$sqlselectage2= mysqli_query(dbhandaler::$con,$selectage2);
		while($arrow=mysqli_fetch_assoc($sqlselectage2)) 
		{
			return $arrow['age2'];
		}
	}
    
    public static function selectage3($sex)
	{
		dbhandaler::dbconnect();
		$selectage3= "select count(Age) as age3 from patient_data where Age between 25 and 44 and Gender in ($sex);";
		$sqlselectage3= mysqli_query(dbhandaler::$con,$selectage3);
		while($arrow=mysqli_fetch_assoc($sqlselectage3)) 
		{
			return $arrow['age3'];
		}
	}

	public static function selectage4($sex)
	{
		dbhandaler::dbconnect();
		$selectage4= "select count(Age) as age4 from patient_data where Age between 45 and 64 and Gender in ($sex);";
		$sqlselectage4= mysqli_query(dbhandaler::$con,$selectage4);
		while($arrow=mysqli_fetch_assoc($sqlselectage4)) 
		{
			return $arrow['age4'];
		}
	}

    public static function selectage5($sex)
	{
		dbhandaler::dbconnect();
		$selectage5= "select count(Age) as age5 from patient_data where Age > 64 and Gender in ($sex);";
		$sqlselectage5= mysqli_query(dbhandaler::$con,$selectage5);
		while($arrow=mysqli_fetch_assoc($sqlselectage5)) 
		{
			return $arrow['age5'];
		}
	}
    
	public static function selectstatus($status,$sex)
	{
		dbhandaler::dbconnect();
		$selectstatus= "select count(Current_Status) as status from patient_data where Current_Status = '$status' and Gender in ($sex);";
		$sqlselectstatus= mysqli_query(dbhandaler::$con,$selectstatus);
		while($arrow=mysqli_fetch_assoc($sqlselectstatus)) 
		{
			return $arrow['status'];
		}
	}

	public static function selectdate($sex)
	{
		$c=array();
		$a=0;
		dbhandaler::dbconnect();
		$selectdate= "select Announce, count(Announce) as cdate from patient_data where Gender in ($sex) GROUP by Announce;";
		$sqlselectdate= mysqli_query(dbhandaler::$con,$selectdate);
		while($arrow=mysqli_fetch_assoc($sqlselectdate)) 
		{	
			$c[$a]= array($arrow['cdate'], $arrow['Announce']);
			$a++;
		}
		return $c;
	}


	public static function selecttwsp($R)
	{
		$twsp = array();
		$b=0;
		dbhandaler::dbconnect();
		$pselecttwsp = "select Township from location where Region = '$R';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			$twsp[$b]=array($twsp1['Township']); 
			$b++;
		}
		return $twsp; 
	}

	public static function selectregion()
	{
		$reg = array();
		$a=0;
		dbhandaler::dbconnect();
		$pselectregion = "select distinct(Region) as Reg from location;";
		$plselectregion= mysqli_query(dbhandaler::$con,$pselectregion);
		while ($hf = mysqli_fetch_assoc($plselectregion)) 
		{ 
			$reg[$a]=array($hf['Reg']); 
			$a++;
		}
	return $reg;
	}

	public static function selectptid()
	{
		$arr=array();
		$a=0;
		dbhandaler::dbconnect();
		$selectptid = "select Case_No from patient_data;";
		$pselectsqlptid= mysqli_query(dbhandaler::$con,$selectptid);
		{
		while ($ptid=mysqli_fetch_assoc($pselectsqlptid)) 
		{ $arr[$a]= array($ptid['Case_No']); $a++;} 
		}
		return$arr;
	}

	public static function insertcmdata($No,$Age,$Gender,$Travel_History,$Treatment_Center,$Announce,$Current_Status,$Township,$State)
	{
		dbhandaler::dbconnect();
		$qinsertcmdata = "insert into patient_data (Case_No,Age,Gender,Travel_History,Treatment_Center,Announce,Current_Status,Township,State,Insert_Time) 
		values ($No,'$Age','$Gender','$Travel_History','$Treatment_Center','$Announce','$Current_Status','$Township','$State',Now());";
		$sqlinsertcmdata= mysqli_query(dbhandaler::$con,$qinsertcmdata);
		echo "<script>alert('Successful Insert!');</script>";
	}

	public static function datetime()
	{
		dbhandaler::dbconnect();
		$qdatetime = "select Insert_Time as status from patient_data WHERE id = (SELECT MAX(id) FROM patient_data);";
		$sqldatetime = mysqli_query(dbhandaler::$con,$qdatetime);
		while($arrow = mysqli_fetch_assoc($sqldatetime)) 
		{
			echo $arrow['status'];
		}
	}

	public static function selectygn()
		{
		dbhandaler::dbconnect();
		$pselectygn = "select * from patient_data where State = 'Yangon';";
		$pselectsqlygn= mysqli_query(dbhandaler::$con,$pselectygn);
		$a =0;
		{?>
		<table style="border: 1px solid black;" id="myatable"> 
		<?php 
		while ($pselectingygn=mysqli_fetch_assoc($pselectsqlygn)) 
		{ $a++; ?> 
	<tr> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Case_No'];?> </td> 
	<td width="50px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Age']; ?> </td> 
	<td width="100px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Gender']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Travel_History']; ?> </td> 
	<td width="400px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Treatment_Center']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Announce']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Current_Status']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['Township']; ?> </td> 
	<td width="250px" align="left" style="border: 1px solid black;"> <?php echo $pselectingygn['State']; ?> </td> 
	</tr>
		<?php } ?>
		</table> 
		<?php }
	}

	public static function selectgenderygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectgenderygn= "select count(Gender) as gender from patient_data where Gender = '$sex' and State in ($State);";
		$sqlselectgenderygn= mysqli_query(dbhandaler::$con,$selectgenderygn);
		while($arrow=mysqli_fetch_assoc($sqlselectgenderygn)) 
		{
			return $arrow['gender'];
		}
	}

	public static function selectage1ygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectage1ygn= "select count(Age) as age1 from patient_data where Age < 15 and State in ($State) and Gender in ($sex);";
		$sqlselectage1ygn= mysqli_query(dbhandaler::$con,$selectage1ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage1ygn)) 
		{
			return $arrow['age1'];
		}
	}

	public static function selectage2ygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age2 from patient_data where Age between 15 and 24 and State in ($State) and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age2'];
		}
	}

	public static function selectage3ygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age3 from patient_data where Age between 25 and 44 and State in ($State) and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age3'];
		}
	}
	public static function selectage4ygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age4 from patient_data where Age between 45 and 64 and State in ($State) and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age4'];
		}
	}
	
	public static function selectage5ygn($sex,$State)
	{
		dbhandaler::dbconnect();
		$selectage3ygn= "select count(Age) as age5 from patient_data where Age > 64 and State in ($State) and Gender in ($sex);";
		$sqlselectage3ygn= mysqli_query(dbhandaler::$con,$selectage3ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage3ygn)) 
		{
			return $arrow['age5'];
		}
	}


	public static function selectstatusygn($status,$sex,$State)
	{
		dbhandaler::dbconnect();
		$selectstatusygn= "select count(Current_Status) as status from patient_data where Current_Status = '$status' and State in ($State) and Gender in ($sex);";
		$sqlselectstatusygn= mysqli_query(dbhandaler::$con,$selectstatusygn);
		while($arrow=mysqli_fetch_assoc($sqlselectstatusygn)) 
		{
			return $arrow['status'];
		}
	}
public static function selectgenderygna($sex)
	{
		dbhandaler::dbconnect();
		$selectgenderygn= "select count(Gender) as gender from patient_data where Gender = '$sex';";
		$sqlselectgenderygn= mysqli_query(dbhandaler::$con,$selectgenderygn);
		while($arrow=mysqli_fetch_assoc($sqlselectgenderygn)) 
		{
			return $arrow['gender'];
		}
	}

	public static function selectage1ygna($sex)
	{
		dbhandaler::dbconnect();
		$selectage1ygn= "select count(Age) as age1 from patient_data where Age < 15 ;";
		$sqlselectage1ygn= mysqli_query(dbhandaler::$con,$selectage1ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage1ygn)) 
		{
			return $arrow['age1'];
		}
	}

	public static function selectage2ygna($sex)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age2 from patient_data where Age between 15 and 24 and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age2'];
		}
	}

	public static function selectage3ygna($sex)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age3 from patient_data where Age between 25 and 44 and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age3'];
		}
	}
	public static function selectage4ygna($sex)
	{
		dbhandaler::dbconnect();
		$selectage2ygn= "select count(Age) as age4 from patient_data where Age between 45 and 64 and Gender in ($sex);";
		$sqlselectage2ygn= mysqli_query(dbhandaler::$con,$selectage2ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ygn)) 
		{
			return $arrow['age4'];
		}
	}
	
	public static function selectage5ygna($sex)
	{
		dbhandaler::dbconnect();
		$selectage3ygn= "select count(Age) as age5 from patient_data where Age > 64 and Gender in ($sex);";
		$sqlselectage3ygn= mysqli_query(dbhandaler::$con,$selectage3ygn);
		while($arrow=mysqli_fetch_assoc($sqlselectage3ygn)) 
		{
			return $arrow['age5'];
		}
	}


	public static function selectstatusygna($status,$sex)
	{
		dbhandaler::dbconnect();
		$selectstatusygn= "select count(Current_Status) as status from patient_data where Current_Status = '$status' and Gender in ($sex);";
		$sqlselectstatusygn= mysqli_query(dbhandaler::$con,$selectstatusygn);
		while($arrow=mysqli_fetch_assoc($sqlselectstatusygn)) 
		{
			return $arrow['status'];
		}
	}
	public static function selectdateygn($sex)
	{
		$c=array();
		$a=0;
		dbhandaler::dbconnect();
		$selectdateygn= "select Announce, count(Announce) as cdate from patient_data where State= 'Yangon' and Gender in ($sex) GROUP by Announce ;";
		$sqlselectdateygn= mysqli_query(dbhandaler::$con,$selectdateygn);
		while($arrow=mysqli_fetch_assoc($sqlselectdateygn)) 
		{	
			$c[$a]= array($arrow['cdate'], $arrow['Announce']);
			$a++;
		}
		return $c;
	}


	public static function selectygnct1()
	{
		$c1=array();
		$a1=0;
		dbhandaler::dbconnect();
		$selectygnct1= "select Contact_Case_Number, count(Contact_Case_Number) as cdate from contact_tracing where Type ='Civilian' GROUP by Contact_Case_Number order by cdate ASC;";
		$sqlselectygnct1= mysqli_query(dbhandaler::$con,$selectygnct1);
		while($arrow=mysqli_fetch_assoc($sqlselectygnct1)) 
		{	
			$c1[$a1]= array($arrow['cdate'], $arrow['Contact_Case_Number']);
			$a1++;
		}
		return $c1;
	}

	public static function selectygnct2()
	{
		$c2=array();
		$a2=0;
		dbhandaler::dbconnect();
		$selectygnct2= "select Contact_Case_Number, count(Contact_Case_Number) as cdate from contact_tracing where Type ='Health Care Provider' GROUP by Contact_Case_Number order by cdate ASC;";
		$sqlselectygnct2= mysqli_query(dbhandaler::$con,$selectygnct2);
		while($arrow=mysqli_fetch_assoc($sqlselectygnct2)) 
		{	
			$c2[$a2]= array($arrow['cdate'], $arrow['Contact_Case_Number']);
			$a2++;
		}
		return $c2;
	}

	public static function selecttypeygnct()
	{
		$c3=array();
		$a3=0;
		dbhandaler::dbconnect();
		$selecttypeygnct= "select Contact, count(Contact) as cdate from contact_tracing where Type='Civilian' GROUP by Contact;";
		$sqlselecttypeygnct= mysqli_query(dbhandaler::$con,$selecttypeygnct);
		while($arrow=mysqli_fetch_assoc($sqlselecttypeygnct)) 
		{	
			$c3[$a3]= array($arrow['cdate'], $arrow['Contact']);
			$a3++;
		}
		return $c3;
	}

	public static function selectcontactygnct()
	{
		$c4=array();
		$a4=0;
		dbhandaler::dbconnect();
		$selectcontactygnct= "select Contact, count(Contact) as cdate from contact_tracing where Type='Health Care Provider' GROUP by Contact;";
		$sqlselectcontactygnct= mysqli_query(dbhandaler::$con,$selectcontactygnct);
		while($arrow=mysqli_fetch_assoc($sqlselectcontactygnct)) 
		{	
			$c4[$a4]= array($arrow['cdate'], $arrow['Contact']);
			$a4++;
		}
		return $c4;
	}

	public static function selectgenderct($sex)
	{
		dbhandaler::dbconnect();
		$selectgenderct= "select count(Gender) as gender from contact_tracing where Gender = '$sex';";
		$sqlselectgenderct= mysqli_query(dbhandaler::$con,$selectgenderct);
		while($arrow=mysqli_fetch_assoc($sqlselectgenderct)) 
		{
			return $arrow['gender'];
		}
	}

	public static function selectage1ct()
	{
		dbhandaler::dbconnect();
		$selectage1ct= "select count(Age) as age1 from contact_tracing where Age < 15 and Gender = 'M';";
		$sqlselectage1ct= mysqli_query(dbhandaler::$con,$selectage1ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage1ct)) 
		{
			return $arrow['age1'];
		}
	}

	public static function selectage2ct()
	{
		dbhandaler::dbconnect();
		$selectage2ct= "select count(Age) as age2 from contact_tracing where Age BETWEEN 15 and 60 and Gender = 'M';";
		$sqlselectage2ct= mysqli_query(dbhandaler::$con,$selectage2ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage2ct)) 
		{
			return $arrow['age2'];
		}
	}
	public static function selectage3ct()
	{
		dbhandaler::dbconnect();
		$selectage3ct= "select count(Age) as age3 from contact_tracing where Age > 60 and Gender = 'M';";
		$sqlselectage3ct= mysqli_query(dbhandaler::$con,$selectage3ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage3ct)) 
		{
			return $arrow['age3'];
		}
	}

	public static function selectage4ct()
	{
		dbhandaler::dbconnect();
		$selectage4ct= "select count(Age) as age4 from contact_tracing where Age < 15 and Gender = 'F';";
		$sqlselectage4ct= mysqli_query(dbhandaler::$con,$selectage4ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage4ct)) 
		{
			return $arrow['age4'];
		}
	}

	public static function selectage5ct()
	{
		dbhandaler::dbconnect();
		$selectage5ct= "select count(Age) as age5 from contact_tracing where Age BETWEEN 15 and 60 and Gender = 'F';";
		$sqlselectage5ct= mysqli_query(dbhandaler::$con,$selectage5ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage5ct)) 
		{
			return $arrow['age5'];
		}
	}
	public static function selectage6ct()
	{
		dbhandaler::dbconnect();
		$selectage6ct= "select count(Age) as age6 from contact_tracing where Age > 60 and Gender = 'F';";
		$sqlselectage6ct= mysqli_query(dbhandaler::$con,$selectage6ct);
		while($arrow=mysqli_fetch_assoc($sqlselectage6ct)) 
		{
			return $arrow['age6'];
		}
	}


	public static function selecttwspygnct()
	{
		$c=array();
		$a=0;
		dbhandaler::dbconnect();
		$selecttwspygnct= "select Address, count(Address) as cdate from contact_tracing GROUP by Address order by cdate DESC";
		$sqlselecttwspygnct= mysqli_query(dbhandaler::$con,$selecttwspygnct);
		while($arrow=mysqli_fetch_assoc($sqlselecttwspygnct)) 
		{	
			$c[$a]= array($arrow['cdate'], $arrow['Address']);
			$a++;
		}
		return $c;
	}

	public static function selectcovidcaseno()
	{
		$c=array();
		$a=0;
		dbhandaler::dbconnect();
		$pselect = "select * from patient_data;";
		$pselectsql= mysqli_query(dbhandaler::$con,$pselect);
		while ($pselecting=mysqli_fetch_assoc($pselectsql)) 
		{ 
			$c[$a]= array($pselecting['Case_No']);
			$a++;	
		} 
		return $c;
	}

	public static function selectcovidbyage($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Age']; 

	}	
	 }
	 public static function selectcovidbygender($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Gender']; 
 
	}	
	 }
	 public static function selectcovidbyth($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Travel_History']; 
	}	
	 }
	 public static function selectcovidbytc($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Treatment_Center']; 

	}	
	 }
	 public static function selectcovidbyan($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Announce']; 

	}	
	 }
	 public static function selectcovidbycs($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 

	  return $pselecting['Current_Status']; 

	}	
	 }
	 public static function selectcovidbytwsp($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{ 
	
	  return $pselecting['Township']; 
 
	}	
	 }
	 public static function selectcovidbystate($no)
	{
		dbhandaler::dbconnect();
		$pselectby = "select * from patient_data where Case_No='$no';";
		$pselectsqlby= mysqli_query(dbhandaler::$con,$pselectby); 
		while ($pselecting=mysqli_fetch_assoc($pselectsqlby)) 
		{  
	  return $pselecting['State']; 
	}	
	 }

	 public static function selecttwspall()
	{
		$twsp = array();
		$b=0;
		dbhandaler::dbconnect();
		$pselecttwsp = "select Township from location order by Township ASC;";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			$twsp[$b]=array($twsp1['Township']); 
			$b++;
		}
		return $twsp; 
	}

	public static function selectregions($twsp)
	{
		dbhandaler::dbconnect();
		$pselecttwsp = "select Region from location where Township = '$twsp';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			return $twsp1['Region']; 
		}
		 
	}

	public static function updatebyid($No,$Age,$Gender,$Travel_History,$Treatment_Center,$Announce,$Current_Status,$Township,$State)
	{
		dbhandaler::dbconnect();
		$qinsertcmdata = " UPDATE `patient_data` SET `Age`='$Age',`Gender`='$Gender',`Travel_History`='$Travel_History',`Treatment_Center`='$Treatment_Center',
		`Announce`='$Announce',`Current_Status`='$Current_Status',`Township`='$Township',`State`='$State' WHERE Case_No = '$No';";
		$sqlinsertcmdata= mysqli_query(dbhandaler::$con,$qinsertcmdata);
		echo "<script>alert('Successful update!');</script>";
	}

	public static function deletebyid($No)
	{
		dbhandaler::dbconnect();
		$qinsertcmdata = "DELETE FROM `patient_data` WHERE Case_No = '$No';";
		$sqlinsertcmdata= mysqli_query(dbhandaler::$con,$qinsertcmdata);
		echo "<script>alert('Successful delete!');</script>";
	}

	public static function selectreg()
	{
		$arr=array();
		$a=0;
		dbhandaler::dbconnect();
		$pselecttwsp = "select distinct(Region) from location;";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			$arr[$a]=$twsp1['Region']; 
			$a++;
		}
		 
		 return $arr;
	}

	public static function counttwp($township)
	{
		dbhandaler::dbconnect();
		$pselecttwsp = "select count(Township) as twsp from patient_data where Township = '$township';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			//echo $pselecttwsp;
			 return $twsp1['twsp'];
		}
	}
	public static function counttwptreat($township)
	{
		dbhandaler::dbconnect();
		$pselecttwsp = "select count(Township) as twsp from patient_data where Township = '$township' and Current_Status='On Treatment';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			//echo $pselecttwsp;
			 return $twsp1['twsp'];
		}
	}
	public static function counttwpdie($township)
	{
		dbhandaler::dbconnect();
		$pselecttwsp = "select count(Township) as twsp from patient_data where Township = '$township' and Current_Status='Die';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			//echo $pselecttwsp;
			 return $twsp1['twsp'];
		}
	}
	public static function counttwpcure($township)
	{
		dbhandaler::dbconnect();
		$pselecttwsp = "select count(Township) as twsp from patient_data where Township = '$township' and Current_Status='Recovery';";
		$plselecttwsp= mysqli_query(dbhandaler::$con,$pselecttwsp); 
		while ($twsp1=mysqli_fetch_assoc($plselecttwsp)) 
		{  
			//echo $pselecttwsp;
			 return $twsp1['twsp'];
		}
	}

}
?>