How to view .pdf files from mysql using php


Dear All I'm able to display the images from mysql. But when I want to display the pdf that also stored in my database I'm not able to do that. When I use this code this code show a small green piece of image but not the .pdf files. This code well works on image . But I'm not able to show .pdf files. can any help me to tell me where in my code I have to cahnge . And I request please give the proper change line that is able to show PDF file. thanks in advance`


    $servername = "localhost";
    $username   = "root";
    $dbname     = "db_dat";
    $password   = "";

    $conn = mysqli_connect($servername, $username, $password, $dbname);


   if (isset($_POST['pass'])) {
    if (isset($_POST['dateofissue'])) {
    if (isset($_POST['dateofexpiry'])) {
    if (isset($_POST['issueplace'])) {
    if (isset($_POST['issueplace'])) {
    if (isset($_POST['content'])) {
    if (isset($_POST['name'])) {
    if (isset($_POST['designation'])) {
    if (isset($_POST['companyaddress'])) {
    if (isset($_POST['dateofbirth'])) {
    if (isset($_POST['image'])) {

    $sql = "SELECT * from upload WHERE EMP_ID='".$empid."'";
    $result = mysqli_query($conn,$sql) ;
    while($row = mysqli_fetch_array($result)){
       $img= '<img src="data:image/jpeg;base64,'.base64_encode( $row['image'] ).'"/>';
<!DOCTYPE html>

            <form method="POST" action="" >
                    <tr><td>Enter Employee Id</td> <td><input type="text" name="content"   id="content"></td></tr>
                    <tr><td><input type="submit" class="FormSubmit"></td></tr>
                    <tr><td>Employee Name</td> <td>        <?php echo $emp_name; ?> </td></tr>
                    <tr><td>Employee desgination</td> <td> <?php echo $desg; ?> </td></tr>
                    <tr><td>Company Address</td> <td>      <?php echo $comp_add; ?> </td></tr>
                    <tr><td>DOB.</td> <td>                 <?php echo $dob; ?> </td></tr>
                    <tr><td>Date of Issue</td> <td>        <?php echo $doi; ?> </td></tr>
                    <tr><td>Date of Expiry</td> <td>       <?php echo $doe; ?> </td></tr>
                    <tr><td>Place of Issue</td> <td>       <?php echo $poi; ?> </td></tr>
                    <tr><td>Passport Image</td> <td>       <?php echo $img; ?> </td></tr>
                    <div class="space"></div>
                    <div id="flash"></div>
                    <div id="show"></div>

This is because you are adding image instead of pdf...there isn't any tag with <pdf like we have for image so create a clickable link.There is a different between pdf and image.

Your clickable link will be generated by

 $img="<a href='"$row['image']."'>Download </a> ";

Another way is to use iframes

where you will create an iframe and open the pdf in iframe

 echo" <iframe src='"$row['image']."'></iframe>";

row['image'] must have a complete path like