<?php

require("../config/config.php");

$name = $_REQUEST['name'];
$vendor_id = $_REQUEST['vendor_id'];
if (!empty($vendor_id)) {
    $sql = "select vendor_id from master_vendors where name = '" . $db_cust->escape($name) . "' and is_deleted ='0' and vendor_id !='" . $vendor_id . "' ";
    $row = $db_cust->query_first($sql);
    $res = $db_cust->affected_rows;

    if ($res > 0) {
        echo 'false';
    } else {
        echo 'true';
    }
} else {
    $sql = "select vendor_id from master_vendors where name = '" . $db_cust->escape($name) . "' and is_deleted ='0' ";
    $row = $db_cust->query_first($sql);

    $res = $db_cust->affected_rows;

    if ($res > 0) {
        echo 'false';
    } else {
        echo 'true';
    }
}
$db_cust->close();
?>
