I am using latest version of php 7.1. In this PHP script getting empty result with success response. But if we use print_r its showing array values in the output.
   <?php
    include 'dbconn.php'; 
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $inputJSON = file_get_contents('php://input');
            $data=json_decode($inputJSON, true);
            $email=$data['providerEmail'];
            $password=$data['providerPassword'];
            if($data){
                $sql="select * from en_providers where providerEmailAddress='".$email."' and providerPW='".$password."'";
                $result = mysqli_query($con,$sql) or die("Error in Selecting " . mysqli_error($connection));
                $row =mysqli_fetch_assoc($result);
                $providerID=$row['providerID'];
                    $sql1="select * from en_venues where providerID='".$providerID."'";
                    $result1 = mysqli_query($con,$sql1) or die("Error in Selecting " . mysqli_error($connection));
                        while($row1['Doctorid'][] =mysqli_fetch_assoc($result1)){
                            $merge=array_merge($row,$row1);
                        }
            if($row){  
                header('WWW-Authenticate: Digest',true,200);   
                $list=$merge;
                echo json_encode($list);
            }
            else
            {
                header('WWW-Authenticate: Digest');
                header('HTTP/1.1 401 Unautherised', true, 401);
                $er='Invalid Username/Password';
                $return['error']=$er;
                echo json_encode($return);   
            } 
        }
        else
        {
            header('WWW-Authenticate: Digest');
            header('HTTP/1.1 401 Unautherised', true, 401);
            $er='Invalid Username/Password';
            $return['error']=$er;
            echo json_encode($return);
        }
    }
    ?>
How to print array values in json response.
please help me how to slove this issue. Thanks
 
    