0) { while ($row = mysqli_fetch_assoc($result)) { error_log("healthadvice:".$row['health_advice_name']); $data[] = $row['health_advice_name']; } } else { $data['status'] = 200; $data['message'] = "Data not found!"; } foreach($data as $d){ error_log("healthadvice datarow:".$d); } echo json_encode($data); ?>