<?php
session_start();
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];
$salent = $_SESSION["salent"];
$maindb = "accmast";
$success = false;

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

$myquery = mysqli_query($conn, "Select `custrate`,`crewot`,`crewot2` from `$maindb` where accode = '$party'") or die(mysqli_error($conn));
$r = mysqli_fetch_assoc($myquery);

$rows = array();
    $ctr = 0;
    $rows = array(
        'success'     => true,
        'rate'    => "$r[custrate]",
        'crewot'   => "$r[crewot]",
        'party'   => "$party",
        'crewot2'      => "$r[crewot2]"
    );

    header("Content-type: application\json");
    echo json_encode($rows);
}