<?php include('includes/config/config.php'); $doc_id =$_REQUEST['doc_id']; $query = "select * from medical_document where id = '".$doc_id."'"; if (!$result = @mysqli_query($conn,$query)) { error_log ( "Failed to retrieve Document Exception:" . mysqli_error($conn) . " Query::: " . $query ); die(mysqli_error($conn)); } $data = array(); if(mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { header("Content-type: " . $row["medical_doc_type"]); echo ($row['medical_doc']); } } else { echo "Data not found!"; } ?>