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

$table	="st_group";
$kode	=$_POST[kode];
$nama	=$_POST[nama];

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