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

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

if ($_REQUEST["code"]){
    $code = $_REQUEST["code"];
     $getvess = mysqli_query($conn, "SELECT `destcode` FROM `ordmain` WHERE vouchno = '$code'")or die(mysqli_error($conn));
     $mves = mysqli_fetch_array($getvess);
     $destcode = $mves['destcode'];
     
     $getvessel = mysqli_query($conn, "SELECT `name` FROM `country` WHERE code = '$destcode'")or die(mysqli_error($conn));
     $mdes = mysqli_fetch_array($getvessel);
     echo $mdes["name"];
}
else{
    echo "ERROR";
}?>
