You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1003 B
PHP
43 lines
1003 B
PHP
<?php
|
|
session_start();
|
|
if($_SESSION['validUser'] !== TRUE)
|
|
{
|
|
header("location: ./index.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<?php
|
|
if(isset($_REQUEST['status']) && $_REQUEST['status'] == 'ok') {
|
|
if ($_REQUEST['operation'] == 'simpanSuppBarang') {
|
|
simpan();
|
|
}
|
|
}
|
|
|
|
function simpan() {
|
|
$kd_supplier = $_POST['kd_supplier'];
|
|
$lini = $_POST['kd_strip'];
|
|
$ranking = $_POST['ranking'];
|
|
$array_data = array();
|
|
if ($kd_supplier != "" && $lini != "" && $ranking != "") {
|
|
require_once 'db_login.inc.php';
|
|
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
|
|
$query = "INSERT INTO supp_barang(kd_supplier, kd_strip, ranking) VALUES(?, ?, ?)";
|
|
$stmt = $mysqli->prepare($query);
|
|
$stmt->bind_param("ssi", $kd_supplier, $lini, $ranking);
|
|
$stmt->execute();
|
|
if($stmt->affected_rows > 0) {
|
|
$array_data[0] = 1;
|
|
} else {
|
|
$array_data[0] = 2;
|
|
}
|
|
$stmt->close();
|
|
/* tutup koneksi */
|
|
$mysqli->close();
|
|
} else{
|
|
$array_data[0] = 3;
|
|
}
|
|
/* cetak hasil */
|
|
echo json_encode($array_data);
|
|
|
|
}
|
|
?>
|