title: Downloading .php file instead of .pdf file when I click download in PHP
body: <p>After a lot of struggle I am able to store pdf files into MySql database and can open them in browser by retriving then. My problem is when I click download option, it is getting download as .php file where as it has to get downloaded in .pdf format. Can any one help me here. Thanks in advance.</p>
  
  <pre><code>&lt;?php
  $id =  $_POST["iid"];` 
  $link = mysqli_connect("localhost", "root", "","test");
  mysqli_select_db($link,"test");
  $sql = "SELECT image FROM test_image WHERE id=$id";
  $result = mysqli_query($link,"$sql");
  $row = mysqli_fetch_assoc($result);
  mysqli_close($link);
  header("Content-type: application/pdf");
  echo $row['image'];
  ?&gt;
  </code></pre>