<?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];

$party = $_REQUEST['party'];
$partycond = '';

if (!empty($_REQUEST['party'])) {
    $partycond = "AND `accode` = '$party' ";
}


$getparty = mysqli_query($conn, "SELECT accode, name, mobile, email, gstno FROM `accmast` WHERE `accode` != '' $partycond ")or die(mysqli_error($conn));
$m = mysqli_fetch_array($getparty);

if ($party != "") {
    $it = 1;
    $nameprint = $m['name'];
    $mobile = $m['mobile'];
    $email = $m['email'];
    $gstno = $m['gstno'];
} 

$rows = array('it' => $it,
    'nameprint' => "$nameprint",
    'printmobile' => "$mobile",
    'email' => "$email",
    'gstno' => "$gstno"
);

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