Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once "ez_sql.php";
- $results = $db->get_results("Select * From fairmount2012 ORDER BY lname, name LIMIT 0,20");
- if(empty($results)){
- echo "<h1>This search contains no data</h1>";
- }else{
- # Include the file that does all of the work
- require('fpdf.php');
- # Start a new PDF file
- $pdf = new FPDF('P','in',array(5.5,8.5));
- #$pdf = new FPDF();
- $pdf->AddPage();
- foreach ( $results as $result )
- {
- #Print Name
- $pdf->SetFont('Arial','B',8);
- $pdf->Ln(.25);
- $pdf->Cell(.375,.125, "$result->name"." "."$result->lname",0,1,'L');
- $pdf->SetFont('');
- if (!empty($result->phone)){
- $pdf->Cell(0,.125,"Home: "."$result->phone",0,1,'L');
- }
- if (!empty($result->cell1)){
- $pdf->Cell(0,.125,"Cell 1: "." "."$result->cell1",0,1,'L');
- }
- if (!empty($result->cell2)){
- $pdf->Cell(0,.125,"Cell 2: "." "."$result->cell1",0,1,'L');
- }
- if (!empty($result->email1)){
- $pdf->Cell(0,.125,"Email 1: "."$result->email1",0,1,'L');
- }
- if (!empty($result->email2)){
- $pdf->Cell(0,.125,"Email 2: "."$result->email2",0,1,'L');
- }
- }
- }
- #create the pdf and stream it to the page
- $pdf->Output();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement