SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | $koneksi = mysqli_connect("localhost", "root", "", "posijb");
| |
| 3 | $noppb = $_POST['noppb']; | |
| 4 | $tgl = $_POST['tgl']; | |
| 5 | $jenis = $_POST['jenis']; | |
| 6 | $keperluan = $_POST['keperluan']; | |
| 7 | $ppb_id = $_POST['ppb_id']; | |
| 8 | ||
| 9 | - | if (isset($_POST["deskripsi"])) |
| 9 | + | if (isset($_POST["deskripsi"])) |
| 10 | {
| |
| 11 | - | $hoby = $_POST["deskripsi"]; |
| 11 | + | $hoby = $_POST["deskripsi"]; |
| 12 | - | reset($hoby); |
| 12 | + | reset($hoby); |
| 13 | - | $koneksi = mysqli_connect("localhost", "root", "", "posijb");
|
| 13 | + | $koneksi = mysqli_connect("localhost", "root", "", "posijb");
|
| 14 | - | foreach ($hoby as $key => $val) |
| 14 | + | foreach ($hoby as $key => $val) |
| 15 | {
| |
| 16 | - | $ppb_id = $_POST["ppb_id"][$key]; |
| 16 | + | $ppb_id = $_POST["ppb_id"][$key]; |
| 17 | - | $deskripsi = $_POST["deskripsi"][$key]; |
| 17 | + | $deskripsi = $_POST["deskripsi"][$key]; |
| 18 | - | $qty = $_POST["qty"][$key]; |
| 18 | + | $qty = $_POST["qty"][$key]; |
| 19 | - | $satuan = $_POST["satuan"][$key]; |
| 19 | + | $satuan = $_POST["satuan"][$key]; |
| 20 | - | $harga = $_POST["harga"][$key]; |
| 20 | + | $harga = $_POST["harga"][$key]; |
| 21 | - | $bayar = $_POST["bayar"][$key]; |
| 21 | + | $bayar = $_POST["bayar"][$key]; |
| 22 | - | $pembayaran = $_POST["pembayaran"][$key]; |
| 22 | + | $pembayaran = $_POST["pembayaran"][$key]; |
| 23 | - | $supplier_id = $_POST["supplier_id"][$key]; |
| 23 | + | $supplier_id = $_POST["supplier_id"][$key]; |
| 24 | - | $rekening = $_POST["rekening"][$key]; |
| 24 | + | $rekening = $_POST["rekening"][$key]; |
| 25 | - | |
| 25 | + | |
| 26 | - | if (mysqli_connect_errno()) {
|
| 26 | + | if (mysqli_connect_errno()) |
| 27 | - | echo "Failed to connect to MySQL: " . mysqli_connect_error(); |
| 27 | + | |
| 28 | - | exit(); |
| 28 | + | echo "Failed to connect to MySQL: " . mysqli_connect_error(); |
| 29 | - | } |
| 29 | + | exit(); |
| 30 | - | $sql_hoby = "UPDATE desppb(deskripsi, qty, satuan, harga, bayar, pembayaran, supplier_id, rekening) VALUES('$deskripsi','$qty','$satuan','$harga','$bayar','$pembayaran','$supplier_id','$rekening') WHERE ppb_id=$ppb_id";
|
| 30 | + | |
| 31 | - | $hasil_hoby = mysqli_query($koneksi, $sql_hoby); |
| 31 | + | $sql_hoby = "replace into desppb(deskripsi, qty, satuan, harga, bayar, pembayaran, supplier_id, rekening) VALUES('$deskripsi','$qty','$satuan','$harga','$bayar','$pembayaran','$supplier_id','$rekening') WHERE ppb_id=$ppb_id";
|
| 32 | - | |
| 32 | + | $hasil_hoby = mysqli_query($koneksi, $sql_hoby); |
| 33 | ||
| 34 | } | |
| 35 | } | |
| 36 | ||
| 37 | - | $sql = "UPDATE ppb(noppb,tgl,jenis,keperluan) |
| 37 | + | $sql = "replace into ppb(noppb,tgl,jenis,keperluan) |
| 38 | VALUES('$noppb','$tgl','$jenis','$keperluan')";
| |
| 39 | //$hasil = mysqli_query($koneksi, $sql); | |
| 40 | $hasil_hoby = mysqli_query($koneksi, $sql); | |
| 41 | //$ppb_id = mysqli_insert_id($koneksi); | |
| 42 | //insert yg balikin id bukan update | |
| 43 | - | if($hasil_hoby) |
| 43 | + | if ($hasil_hoby) |
| 44 | {
| |
| 45 | proses_hoby($ppb_id); | |
| 46 | redirect('ppb');
| |
| 47 | } | |
| 48 | else | |
| 49 | {
| |
| 50 | echo "Data Gagal diinput"; | |
| 51 | } | |
| 52 | ||
| 53 | - | ?> |
| 53 | + | ?> |
| 54 |