<?php 
include('../db_connect.php');
mysqli_set_charset($conn, 'utf8');
$response = array();

try
{

    $query = mysqli_query($conn, "SELECT * FROM `fitnessdata`");

    if(mysqli_num_rows($query)>=1){

        while($row = mysqli_fetch_assoc($query)){
            $data[] = $row;
        }
        $response['data'] = $data;
        $response['error']= false;
    }else{
        $response['error']= false;
        $response['data'] = "No Record Found";

    }

}
catch(Exception $e){
    $response['error']= true;
    $response['message']="Some error occured, " . $e;
}

header('Content-Type: application/json');
echo json_encode($response, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
mysqli_close($conn);

?>