<?php include('includes/config/config.php'); include('includes/functions.php'); $itemId = $_REQUEST['item_id']; $query = "select * from item_salt a left join salt_master b on a.salt_id = b.salt_id where a.item_id='".$itemId."' "; error_log($query); $count=0; if (!$result = @mysqli_query($conn,$query)) { exit(mysqli_error($conn)); } $data = array(); // $item_name=getTableFieldValue('tbl_items','item_name','item_id',$_REQUEST['item_id']); // array_push($data,$item_name); // } if(mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { if(!empty(['salt_id'])){ array_push($data,$row['salt_id']); $count++; } } } $data['count']=$count; error_log("str allergy_items ".print_r($data,true)); echo json_encode($data); ?>