<?php include('includes/config/config.php'); include('includes/functions.php'); $itemId = $_REQUEST['item_id']; $data = []; $query = "select salt_id from item_salt where item_id='" . $itemId . "' "; error_log("query for salt getting " . $query); if (!$result = @mysqli_query($conn, $query)) { error_log("error here " . mysqli_error($conn)); die(mysqli_error($conn)); } else { $i = 0; while ($row = mysqli_fetch_assoc($result)) { $data[$i++] = $row['salt_id']; } } error_log("str allergy_items " . print_r($data, true)); echo json_encode($data);