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