<?php

require_once "config.php";
$id=$_POST['id'];
$edit_order_date=$_POST['edit_order_date'];
$customer_name=$_POST['customer_name'];
$edit_due_date=$_POST['edit_due_date'];
$edit_po_no=$_POST['edit_po_no'];

$sql="select * from production_details where po_no='".$edit_po_no."' and  customer_name='".$customer_name."' and id!='".$id."'";
$query=mysqli_query($con,$sql);
if($result=mysqli_fetch_array($query)){
    die("Production status exists");
}
$sql="update production_details set customer_name='".$customer_name."',po_no='".$edit_po_no."',due_date='".$edit_due_date."',order_date='".$edit_order_date."' where id='".$id."'";
$query=mysqli_query($con,$sql);
if($query==false){
    die(mysqli_error($con));
}
echo mysqli_affected_rows($con);


?>