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

$table		="customer";

$kode	=$_POST[kode];
$nama	=$_POST[nama];
$alamat	=$_POST[alamat];
$telepon=$_POST[telepon];
$fax	=$_POST[fax];
$nobank	=$_POST[nobank];
$kontak	=$_POST[kontak];

$sql1   = mysql_query("SELECT * FROM akun_bb WHERE noakun= '$nobank'");
$r1     = mysql_fetch_assoc($sql1);
$nabank = $r1[naakun];

$sql = mysql_query("SELECT * FROM $table WHERE kode_pl= '$kode'");
$row = mysql_num_rows($sql);
if ($row>0){
	mysql_query("UPDATE $table SET nama='$nama',alamat='$alamat',telepon='$telepon',fax='$fax',nobank='$nobank',nabank='$nabank',kontak='$kontak',lastupdate=now() WHERE kode_pl= '$kode'");
	echo "Data sukses diubah.";
}
else{
	mysql_query("INSERT INTO $table (kode_pl,nama,alamat,telepon,fax,nobank,nabank,kontak) VALUES('$kode','$nama','$alamat','$telepon','$fax','$nobank','$nabank','$kontak')");
	echo "Data sukses direkam.";
}
?>