Search code examples
mysqlpdfpdf-generationfpdf

How to create pdf file with mysql data?


Can anyone give me simple example, how to create pdf file with mysql data? Im using fpdf http://www.fpdf.org/ for pdf creation. I want to print these data:

$result = mysql_query("SELECT Name, Profesion, Email FROM customers") 
or die(mysql_error());
        if(mysql_num_rows($result) > 0) {
        while($row = mysql_fetch_assoc($result)) {

    echo '
    <td width="200px">'.$row['Name'].'</td> 
   <td width="200px">'.$row['Profesion'].'</td> 
   <td> width="200px">'.$row['Email'].'</td>'; }
    }

Solution

  • Have you looked at the scripts section on their site? They have a few good examples of creating a PDF table/report from MySQL. Hope this helps.

    http://www.fpdf.org/en/script/index.php