<?php
require_once "connection.php";
if(isset($_GET['phoneNumber'])){
    $sql = "select fullName,phoneNumber,email,address from nasabah where phoneNumber='".$_GET['phoneNumber']."'";
    if(!$con->query($sql)){
        echo "Error in executing query.";
    }else{
        $result = $con->query($sql);
        if($result->num_rows > 0){
            $return_arr['nasabah'] = array();
            while($row = $result->fetch_array()){
                array_push($return_arr['nasabah'], array(
                    'fullName'=>$row['fullName'],
                    'phoneNumber'=>$row['phoneNumber'],
                    'email'=>$row['email'],
                    'address'=>$row['address'],
                ));
            }
            echo json_encode($return_arr);
        }
}
}
