<?php error_reporting(E_ERROR | E_PARSE); include('includes/config/config.php'); //$sql="select a.*,b.* from requisition_items a inner join tbl_items b on a.item_id=b.item_id where req_id='".$_POST['req_id']."' " ; $sql = "SELECT a.ambulance_usage_id , c.patient_name , a.usage_date FROM ambulance_usage_details a INNER JOIN patient_master c ON a.patient_id = c.id WHERE `ambulance_id` = '" . $_REQUEST['id'] . "' "; error_log($sql); if (!$result_sql = @mysqli_query($conn, $sql)) { exit(mysqli_error($conn)); } $data = array(); if (mysqli_num_rows($result_sql) > 0) { while ($fetch = mysqli_fetch_assoc($result_sql)) { //extract($row); $data[] = $fetch; } } else { $data['status'] = 200; $data['message'] = "Data not found!"; } echo json_encode($data); ?>