<?php

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

$array = '';
$zroot = $_SESSION['zdbroot'];
$zdb = $_SESSION["zdbyear_" . $dbname];
//mysqli_select_db($conn,$zdb);

if (isset($_REQUEST['gval'])) {
    $sval = $_REQUEST['gval'];
    $soval = $_REQUEST['goval'];
    $smmval = $_REQUEST['sizemm'];
    if ($soval == "1") {

        $result = mysqli_query($conn,"SELECT `mm` FROM `$zroot`.`guage` WHERE guage ='$sval' limit 0,1") or die(mysqli_error($conn));
        $get = mysqli_fetch_array($result);
        if ($get == '') {
            echo $sval;
        } else {
            echo $get[mm];
        }
    } else if ($soval == "3") {
        echo $sval;
    } else if ($soval == "2") {

        $result = mysqli_query($conn,"SELECT `schmm` FROM `$zroot`.`nbmetric` WHERE mm = '$smmval' and sch  ='$sval' limit 0,1") or die(mysqli_error($conn));
        $get = mysqli_fetch_array($result);
        if ($get == '') {
            echo $sval;
        } else {
            echo $get[schmm];
        }
    }
}
?>
