title: How to embedd a PDF file from Database / PHP in HTML
body: <p>I want to get a PDF File from a BLOB in my MySQL Database. The PHP for showing the PDF works fine:</p>
  
  <pre><code>&lt;?php
  
  
  $mysqli = new mysqli("192.168.1.11", "root", "password", "DB");
  if ($mysqli-&gt;connect_errno) {
      die("Connection refused: " . $mysqli-&gt;connect_error);
  }
  
  try{
     $sql = "SELECT file FROM table WHERE id = 1";
     $result = mysqli_query($mysqli, $sql);        
     $row = mysqli_fetch_object($result);
     header('Content-type: application/pdf');
  
     echo $row-&gt;file;   
  
  }catch(Exception $e){
      echo "caught exception: ", $e-&gt;getMessage(), "\n";
  }
  
  ?&gt;
  </code></pre>
  
  <p>Now i want to embed this PDF File into a HTML. I tried something like this:</p>
  
  <pre><code>&lt;?php
  $pdf = "MY_PDF_FILE.PDF";        ◄
  echo &lt;&lt;&lt;BLOCK
    &lt;!DOCTYPE html&gt;
    &lt;html&gt;
      &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
        &lt;title&gt;Embeded PDF&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;embed src="$pdf" type="application/pdf" height="25%" width="25%"&gt;
       &lt;/body&gt;        ▲
    &lt;/html&gt;
      BLOCK;
  ?&gt;
  </code></pre>
  
  <p>I tried to save the <code>$row->file;</code> in the <code>$pdf</code> with <code>$pdf = $row->file;</code>. Always when i try to call the index.php of my website, it shows up, that the PDF File cannot be displayed and i only see the browsers PDF Viewer. </p>
  
  <p>Can someone help me with this? :/</p>