title: How to display .pdf files from mysql using php
body: <p>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`</p>
  
  <pre><code>&lt;?php
  
      $servername = "localhost";
      $username   = "root";
      $dbname     = "db_dat";
      $password   = "";
  
  
      $conn = mysqli_connect($servername, $username, $password, $dbname);
  
      $passno="";
      $doi="";
      $doe="";
      $poi="";
      $empid='';
      $emp_name='';
      $desg='';
      $comp_add='';
      $dob='';
      $img='';
  
  
     if (isset($_POST['pass'])) {
          $passno=$_POST['pass'];
      }
      if (isset($_POST['dateofissue'])) {
          $doi=$_POST['dateofissue'];
      }
      if (isset($_POST['dateofexpiry'])) {
          $doe=$_POST['dateofexpiry'];
      }
      if (isset($_POST['issueplace'])) {
          $poi=$_POST['issueplace'];
      }
      if (isset($_POST['issueplace'])) {
          $poi=$_POST['issueplace'];
      }
      if (isset($_POST['content'])) {
          $empid=$_POST['content'];
      }
      if (isset($_POST['name'])) {
          $emp_name=$_POST['name'];
      }
      if (isset($_POST['designation'])) {
          $desg=$_POST['desgination'];
      }
      if (isset($_POST['companyaddress'])) {
          $comp_add=$_POST['companyaddress'];
      }
      if (isset($_POST['dateofbirth'])) {
          $dob=$_POST['dateofbirth'];
      }
      if (isset($_POST['image'])) {
          $img=$_POST['image'];
      }
  
  
  
      $sql = "SELECT * from upload WHERE EMP_ID='".$empid."'";
      $result = mysqli_query($conn,$sql) ;
      while($row = mysqli_fetch_array($result)){
         $img= '&lt;img src="data:image/jpeg;base64,'.base64_encode( $row['image'] ).'"/&gt;';
         $passno=$row['passport_no'];
         $doi=$row['dateofissue'];
         $doe=$row['dateofexpiry'];
         $poi=$row['placeofissue'];
         $empid=$row['EMP_ID'];
         $emp_name=$row['employee_name'];
         $desg=$row['designation'];
         $comp_add=$row['company_address'];
         $dob=$row['dateofbirth'];
      }
  ?&gt;    
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
  
  
          &lt;body&gt;
              &lt;form method="POST" action="" &gt;
                  &lt;table&gt;
                      &lt;tr&gt;&lt;td&gt;Enter Employee Id&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="content"   id="content"&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;&lt;input type="submit" class="FormSubmit"&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Employee Name&lt;/td&gt; &lt;td&gt;        &lt;?php echo $emp_name; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Employee desgination&lt;/td&gt; &lt;td&gt; &lt;?php echo $desg; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Company Address&lt;/td&gt; &lt;td&gt;      &lt;?php echo $comp_add; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;DOB.&lt;/td&gt; &lt;td&gt;                 &lt;?php echo $dob; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Date of Issue&lt;/td&gt; &lt;td&gt;        &lt;?php echo $doi; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Date of Expiry&lt;/td&gt; &lt;td&gt;       &lt;?php echo $doe; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Place of Issue&lt;/td&gt; &lt;td&gt;       &lt;?php echo $poi; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;&lt;td&gt;Passport Image&lt;/td&gt; &lt;td&gt;       &lt;?php echo $img; ?&gt; &lt;/td&gt;&lt;/tr&gt;
                      &lt;div class="space"&gt;&lt;/div&gt;
                      &lt;div id="flash"&gt;&lt;/div&gt;
                      &lt;div id="show"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/table&gt;
              &lt;/form&gt;    
          &lt;/body&gt;
      &lt;/head&gt;    
  &lt;/html&gt;
  </code></pre>