<?php

include "../../root.class.php";
$db = new db_safeguard();
$asset_barcode = $_POST['asset_barcode'];
$res = $db->query("assets", "SELECT * FROM assets WHERE barcode = '$asset_barcode' AND company_id = '{$_SESSION['company_id']}' LIMIT 1");

if (
    $res->num_rows > 0
) {
    $data = $res->fetch_assoc();
    echo $data['record_id'];
} else {
    echo 0;
}