title: pdf download from mysql database
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1204630/create-a-pdf-file-with-php">Create a PDF file with PHP</a>  </p>
  </blockquote>
  
  
  
  <p>i need help..i want a php code  to download information stored in the mysql database and save it  in a pdf file..
  so far, below is the code i have but it's not printing anything..
  please help me to modify it or send me another better code.
  thanks..</p>
  
  <pre><code>&lt;?php
  $host = 'localhost';
  $user = 'root';
  $pass = 'hello';
  $db = 'version';
  $table = 'childinfo';
  $file = 'export';
  $csv_output;
  
  $link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
  mysql_select_db($db) or die("Can not connect.");
  
  
  $gotten =mysql_query("select sex,childnumber from child_nfo");
  $row =mysql_fetch_assoc($gotten);
  $bytes = $row[imgdata];
  header("Content-type: application/pdf");
  header('Content-disposition: attachment; filename="thing.pdf"');
  print $bytes;
  ?&gt; 
  </code></pre>