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

$table		="jabatan";
$kode		=str_replace("'","\'",$_POST[kode]);
$nama		=str_replace("'","\'",$_POST[nama]);

$sql = mysql_query("SELECT kode_jab,nama_jab FROM $table WHERE kode_jab= '$kode'");
$row	= mysql_num_rows($sql);
if ($row>0){
	$input	= "UPDATE $table SET nama_jab='$nama',lastupdate=now() WHERE kode_jab= '$kode'";
	mysql_query($input);								
	echo "Data Sukses diubah.";
}
else{
	$input = "INSERT INTO $table (kode_jab,nama_jab) VALUES('$kode','$nama')";
	mysql_query($input);
	echo "Data sukses disimpan";
}	
?>