<?php
include "../../inc/inc.koneksi.php";

$table	="akun_bp";
$nobb 	=$_POST['tnobb'];
$noakun=$_POST['tnoakun'];
$naakun=$_POST['tnaakun'];
$kode	=$_POST['tkode'];
$tahun	=$_POST['ttahun'];

$sql 	= mysql_query("SELECT * FROM $table WHERE noakun= '$noakun'");
$row	= mysql_num_rows($sql);
if ($row>0){
	$input	= "UPDATE $table SET naakun='$naakun',lastupdate=now() WHERE noakun= '$noakun'";
	mysql_query($input);								
	echo "Data sukses diubah.";
}
else{
	$input = "INSERT INTO $table (noakun,naakun,nobb,kode,tahun,saldo,mutasi_db,mutasi_kd,saldo_tl,lastupdate) VALUES('$noakun','$naakun','$nobb','$kode','$tahun','0','0','0','0',now())";
	mysql_query($input);
	echo "Data sukses disimpan";
}	
?>