Advertisement
Guest User

Untitled

a guest
Jul 31st, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. <?php
  2. include_once "ez_sql.php";
  3.  
  4. $results = $db->get_results("Select * From fairmount2012 ORDER BY lname, name LIMIT 0,20");
  5.  
  6. if(empty($results)){
  7.  
  8.     echo "<h1>This search contains no data</h1>";
  9.  
  10.     }else{
  11.  
  12.         # Include the file that does all of the work
  13.         require('fpdf.php');
  14.  
  15.         # Start a new PDF file
  16.         $pdf = new FPDF('P','in',array(5.5,8.5));
  17.         #$pdf = new FPDF();
  18.         $pdf->AddPage();
  19.  
  20.         foreach ( $results as $result )
  21.             {
  22.                 #Print Name
  23.                 $pdf->SetFont('Arial','B',8);
  24.                 $pdf->Ln(.25);
  25.                 $pdf->Cell(.375,.125, "$result->name"." "."$result->lname",0,1,'L');
  26.                 $pdf->SetFont('');
  27.  
  28.                 if (!empty($result->phone)){
  29.                 $pdf->Cell(0,.125,"Home: "."$result->phone",0,1,'L');
  30.                 }
  31.  
  32.                 if (!empty($result->cell1)){
  33.                 $pdf->Cell(0,.125,"Cell 1: "." "."$result->cell1",0,1,'L');
  34.                 }
  35.  
  36.                 if (!empty($result->cell2)){
  37.                 $pdf->Cell(0,.125,"Cell 2: "." "."$result->cell1",0,1,'L');
  38.                 }
  39.  
  40.                 if (!empty($result->email1)){
  41.                 $pdf->Cell(0,.125,"Email 1: "."$result->email1",0,1,'L');
  42.                 }
  43.  
  44.                 if (!empty($result->email2)){
  45.                 $pdf->Cell(0,.125,"Email 2: "."$result->email2",0,1,'L');
  46.                 }
  47.             }
  48.         }
  49.  
  50. #create the pdf and stream it to the page
  51. $pdf->Output();
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement