<?php
	include "koneksi.php";
	$nama=mysqli_real_escape_string($conn,$_POST["nama"]);
	$id=mysqli_real_escape_string($conn,$_GET["id"]);
	$nik=$_POST["nik"];
	$nomorrekeningbni=$_POST["nomorrekeningbni"];
	$nomorrekeningmybank=$_POST["nomorrekeningmybank"];
	$nomorrekeninguob=$_POST["nomorrekeninguob"];
	//$q="UPDATE merk_sparepart SET nama='$nama' WHERE id='$id'";
	//mysqli_query($conn,$q);
	//header("location:merksparepart.php?p=1");
	
	//if (empty($nama))
	//{
	//	header("location:updatemerksparepart.php?p=1&id=".$id);
	//}
	//else
	//{
		$q="SELECT * FROM data_karyawan WHERE id=$id"; 
		$res=mysqli_query($conn,$q);
		echo "query :" .$q;
		if ($res)
		{
			$q="UPDATE data_karyawan SET no_rekening_bni='$nomorrekeningbni',no_rekening_mybank='$nomorrekeningmybank',no_rekening_uob='$nomorrekeninguob' WHERE id='$id'";
			//$update = $conn->query($q);
			$update = mysqli_query($conn, $q);
			echo "query :" . $q;
		    if (! $update)
		    {
			     echo "gagal update";
			     header("location:updaterekeningkaryawan.php:?p=2");
		    }
			else if ($update)
			{
				echo "berhasil update";
				header("location:updaterekeningkaryawan.php?p=1");
			}
		}
		else
		{
			echo "gagal update";
		}
?>