<?php 
include('includes/config/config.php');
include('includes/auth/auth.php');
include('includes/functions.php');include('access.php');
error_reporting(E_ERROR | E_PARSE);

$param_name=$_REQUEST['id'];
$data = [];

$get_advices = "select * from checkup_parameter where column_name='".$param_name."'";
$result_advices = mysqli_query($conn,$get_advices);
$row_risk_ids = mysqli_fetch_assoc($result_advices);

error_log("get risk ids ".$get_advices);

$advices_names = getCommaSeperatedValuesForInClause("select health_advice_name from health_advice",'health_advice_id',$row_risk_ids['less_advices']);

$less_advices_ids = explode(",",$advices_names);
$data = $less_advices_ids;
error_log("advice names ".print_r($data,true));

echo json_encode($data);
?>