<?php
include "config.php";
if (isset($_POST['update'])) 
    {
        
        extract($_POST);

       $abc=mysqli_query($connect,"select * from tbl_payee where fld_payee_name='".$_POST['payee']."' and fld_payee_id!='".$_POST['payee']."'and fld_payee_delete='0'");
         if(mysqli_num_rows($abc)==1)
            {
            echo '<script type="text/javascript">'; 
            echo 'alert("Payee Is Already Exist");';
            echo "window.location.href = 'view_payee.php';";
            echo '</script>'; 
            

        }    
        else
        {

            $query="Update tbl_payee set fld_payee_name='".$payee."' where fld_payee_id='".$_GET['fld_payee_id']."' ";
            //echo $query."<br>";
            $row=mysqli_query($connect,$query) or die(mysqli_error($connect));
            if ($row) 
            {
                echo "<script>";
                echo "alert('Payee Updated Successfully');";
                echo "window.location.href='view_payee.php';";
                echo "</script>";                 
            }
            else
            {
                echo "<script>";
                echo "alert('Payee Not Update.);";
                echo "window.location.href='view_payee.php';";
                echo "</script>";
            }
        }    
    }
?>