<?php
include('class/mysql_crud.php');
$db_finger=new Database();
$db_finger->connect();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$db_finger->select('emp','*',NULL,'','','');
$data_ptk_finger = $db_finger->getResult();
$jml_data_ptk_finger=$db_finger->numRows();	
echo"Jumlah Data PTK pada Database Fingerprint : $jml_data_ptk_finger<br>";

$db_finger->select('ptk','*',NULL,'','','');
$data_ptk_finger = $db_finger->getResult();
$jml_data_ptk_finger=$db_finger->numRows();	
echo"Jumlah Data ptk pada Database Absensi : $jml_data_ptk_finger";
?>
<form method="post" action="data.php">
<input type="hidden" name="proses" value="1" />
<input type="submit" value="SINKRON" />
</form>
<?php
if(isset($_POST['proses'])){
$db_finger->select('emp','*',NULL,'','','');
$data_ptk_finger = $db_finger->getResult();
foreach($data_ptk_finger as $d_data_ptk_finger){

	$pin=$d_data_ptk_finger['pin'];
	$nama=$d_data_ptk_finger['alias'];	
echo"$pin <br>";

$db_finger->select('ptk','*',NULL,'pin="'.$pin.'"','','');
$cek=$db_finger->numRows();
if($cek==0){
$db_finger->insert('ptk',array('pin'=>$pin,'nama'=>$nama));	
$res = $db_finger->getResult(); 
print_r($res);
}
}
}
?>
</body>
</html>