$result1_array['vehicleNo'] = $result6['vehicleno']; $result1_array['driver'] = $result6['drivername']; $result1_array['TranspAgency'] = $result6['transportagency']; $result1_array['cost'] = $result6['cost']; if ($result6['transportationmode'] != null) { $result1_array['tranReq'] = true; } array_push($json_response, $result1_array); //push the values in the array } echo json_encode($json_response); } break; case "Inquiry": $keywords = "%" . $prodBatchinfo->Keywords . "%"; if (AppUtil::isSuperUser($userId)) { $stmt1 = $dbh->prepare("SELECT * FROM production_batch_master where batchno like :keywords and productionbatchmasterid IN (select productionbatchmasterid from produced_good)"); $stmt1->bindParam(':keywords', $keywords, PDO::PARAM_STR, 10); } else { $stmt1 = $dbh->prepare("SELECT * FROM production_batch_master where batchno like :keywords and productionbatchmasterid IN (select productionbatchmasterid from produced_good) and creuserid=:userId"); $stmt1->bindParam(':keywords', $keywords, PDO::PARAM_STR, 10); $stmt1->bindParam(':userId', $userId, PDO::PARAM_STR, 10); } if ($stmt1->execute()) { $json_response = array(); while ($result1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { $result1_array = array(); $result1_array['productionbatchmasterid'] = $result1['productionbatchmasterid']; $result1_array['batchNo'] = $result1['batchno']; $result1_array['batchCodeName'] = $result1['batchcodename']; //$newDate = date("d-m-Y", strtotime($result1['dateofentry']));