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

$table	="driver";

$kode		=$_POST[kode];
$nama		=$_POST[nama];
$alamat		=$_POST[alamat];
$nomorhp	=$_POST[nomorhp];

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