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

$id = $_POST['product_id'];
$material = $_POST['material'];
$item_desc = $_POST['item_desc'];
$sloc = $_POST['sloc'];
$qty_unit = $_POST['qty_unit'];
$folder = $_POST['folder'];
		if ($material == '') {
			$data['error']['edit_material'] = 'Material tidak boleh kosong';
		}
		if ($item_desc == '') {
			$data['error']['edit_item_desc'] = 'Item Description Tidak Boleh Kosong';
		}
		if ($sloc == '') {
			$data['error']['edit_sloc'] = 'SLoc Tidak Boleh Kosong';
		}
		if ($qty_unit == '') {
			$data['error']['edit_qty_unit'] = 'Quantity Unit tidak boleh kosong';
		}
		if ($folder == '') {
			$data['error']['edit_folder'] = 'Folder tidak boleh kosong';
		}

		if (empty($data['error'])) {
			$query = "UPDATE product SET
											Material = '$material',
											ItemDescription = '$item_desc',
											SLoc = '$sloc',
											QtyUnit = '$qty_unit',
											Folder = '$folder'
											WHERE ProductID = '$id'
											";

			mysqli_query($koneksi, $query)
			or die ("Gagal Perintah SQL".mysql_error());
			$data['hasil'] = 'sukses';
		} else {
			$data['hasil'] = 'gagal';
		}
		echo json_encode($data);

?>

