karlokokkak

Untitled

Apr 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2. $con = mysqli_connect('localhost', 'root', '', 'karat');
  3.  
  4. $tgl=date('Y-m-d');
  5.  
  6. if(isset($_POST['update'])){
  7.     mysqli_query($con,"update servis set name_servis='{$_POST['name_servis']}', gol= 1 where code_servis='{$_POST['code_servis']}'");
  8.     mysqli_query($con,"delete from servis_detil where kd_servis='{$_POST['code_servis']}'");
  9.  
  10.     foreach($_POST['nm_prod'] as $key => $judul){
  11.         if(!$judul){
  12.             continue;
  13.         }
  14.         $sql = mysqli_query($con, "insert into servis_detil (kd_servis, kd_prod, nm_prod, qty)
  15.         values ('{$_POST['code_servis']}','{$_POST['kd_prod'][$key]}','{$judul}','{$_POST['qty'][$key]}')");
  16.  
  17.     }
  18.    
  19.     mysqli_query($con,"insert into outbox (number, date, code_prod, name_prod, price, stock)
  20.                    values('{$_POST['code_servis']}','$tgl','{$_POST['kd_prod'][$key]}','{$judul}','0','{$_POST['qty'][$key]}')")or die(mysqli_error());
  21.  
  22.     header("Location: servis.php"); exit();
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment