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


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

if(isset($_REQUEST['name'])){
   $code   = mysqli_real_escape_string($conn, $_REQUEST["name"]);
   $result = mysqli_query($conn, "SELECT `cost` , `rate` FROM `rawmat` WHERE `name`='$code'") or die(mysqli_error($conn));
   $array  = mysqli_fetch_object($result);
   
   $fetch = array(
     'rate'     =>$array->rate,
     'cost'     =>$array->cost
   );
   header("Content-type: application/json");
   echo json_encode($fetch);
}
?>
