prepare("UPDATE `tPembelian$pemakai` SET `kode_barang` = '$kodebarang', `barcode` = '$barcode', `nm_brg` = '$nama', `jumlah` = '$jmlbeli', `subtotal` = '$subtotal', `disc` = '$disc', `discrp` = '$discrp', `profit` = '$profit', `ppn` = '$ppn', `harga_pokok` = '$hpbaru', `harga_jual` = '$hjbaru', `exp` = '$expdate' WHERE id = '$id'"); $dtUpdate->execute(); if($dtUpdate->affected_rows > 0) { $harray[0] = 1; $dtUpdate->close(); } else { $harray[0] = 0; } $mysqli->close(); }else{ $harray[0] = 2; } echo json_encode($harray); ?>