
<?php
require ('../credentials.php');
 
 
$con=mysqli_connect(HOST, USERNAME, PASSWORD, DBNAME)or die("cannot connect"); 

if(isset($_REQUEST['user_id'])){

$mat_no =$_REQUEST['user_id'];

$sql= "SELECT * FROM parent_children JOIN student on (parent_children.student_id=student.user_id) WHERE parent_children.parent_id='$mat_no'";

//echo $sql;
$result = mysqli_query($con, $sql) or die("Error in Selecting " . mysqli_error($con));
//create an array
    $ward_array = array();
    while($row =mysqli_fetch_assoc($result)){
		$ward_array[] = $row;
		}
		
		
		
echo json_encode($ward_array);

} else {
    // required post params is missing
    $response["error"] = TRUE;
    $response["error_msg"] = "no user_id found";
    echo json_encode($response);
}


mysqli_close($con);

?>
