0) { while ($row = mysqli_fetch_assoc($result)) { // $data[$x] = $row; //$data[]=$row; //$x++; //$data[$x]=$row; $data[$x]['health_score']=$row['health_score']; $data[$x]['checkup_date']=date_format(date_create($row['checkup_date']),"d-M-Y"); $x++; } } else { $data['status'] = 200; $data['message'] = "Data not found!"; } echo json_encode($data); ?>