<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

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


if (isset($_REQUEST["item"])) {
    $item = $_REQUEST['item'];

    $getm = mysqli_query($conn, "SELECT unit FROM `rawmat` WHERE `code`='$item'") or die(mysqli_error($conn));
    $ttgrp = mysqli_fetch_array($getm);

    $getunitname = mysqli_query($conn, "SELECT name FROM `unit` WHERE `code`='" . $ttgrp['unit'] . "'") or die(mysqli_error($conn));
    $ttunit = mysqli_fetch_array($getunitname);

        echo $ttunit['name'];

}