<?php

$name=$_POST['name'];
$check_no=$_POST['check_no'];

$invoice_date=$_POST['issued_date'];
$amount=$_POST['amount'];
$credit_date=$_POST['bar_date'];

require_once "config.php";

$sql="select * from pdc_details where  check_no='".$check_no."' and customer_name='".$name."'";
$query=mysqli_query($con,$sql);
if($result=mysqli_fetch_array($query)){
    die("Customer and Check exists");
}


$sql="insert into pdc_details(customer_name,check_no,issued_date,amount,bar_date) values('".$name."','".$check_no."','".$invoice_date."','".$amount."','".$credit_date."')";
$query=mysqli_query($con,$sql);
$count=mysqli_affected_rows($con);


if($query==false){
    die(mysqli_error($con));
}
echo $count;


?>