title: how to download a .pdf file from mysql database using php?
body: <p>I am using the following code to download a pdf file from mysql database. The code works perfectly with localhost, pdf gets downloaded. But now when the site is live, I can't download the file. It throws some characters like these on the screen..Úáâãäåæçèéêñòóôõö÷øùúÿÄ ÿÄ.</p>
  
  <p>My code is:</p>
  
  <pre><code>if (isset($_POST['download']))
  {
  $Tno2 = $_SESSION['Tno'];
  $gotten = @mysql_query("select * from tenders where Tno = '$Tno2'");
  $row1 = @mysql_fetch_assoc($gotten);
  $bytes = $row1[file];
  if (empty($bytes))
    {
      echo "&lt;b&gt;Tender document not available for this tender.&lt;/b&gt;";
    }
  else
    {
      header("Content-type: application/pdf");
      header('Content-disposition: attachment; filename="Tenderdoc.pdf"');
      print $bytes;
    }
   }
  </code></pre>
  
  <p>Please suggest the required changes in my code or anything which i might be missing. Thanks.</p>