<?php
ini_set('display_errors', 1);
error_reporting(E_ERROR);
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

if (isset($_REQUEST['barcode'])) {
    $barcode = $_REQUEST["barcode"];
    $code = $_REQUEST["code"];
    $gcheckexist = 0;
    $checkexist = mysqli_query($conn, "SELECT * FROM `product` Where `barcode`='$barcode' and `code` != '$code'") or die(mysqli_error($conn));
    if (!empty($checkexist)) {
        $gcheckexist = mysqli_num_rows($checkexist);
    }
    echo "$gcheckexist";
}