Jump to content

Help with PHP fpdf


Darkmatter5

Recommended Posts

Here's my report page.

<?php
define('FPDF_FONTPATH','../library/font/');
require('../library/fpdf.php');
    include '../library/dbconfig.php';
    include '../library/opendb.php';	

/*class PDF extends FPDF {
	function Header() {
            $this->SetFont('Arial','B',15);
            $this->Cell(80);
            $this->Cell(30,10,'Title',1,0,'C');
            $this->Ln(20);
        }
        function Footer() {
		$this->SetY(-15);
		$this->SetFont('Arial','I',10);
		$this->Cell(0,10,'Page ' .$this->PageNo().'/{nb}',0,0,'C');
	}
}*/

$pdf=new FPDF('L','pt','Letter');

$date=date("Y-m-d");
    $rowsPerPage=30;
$query="SELECT COUNT('first_name') AS numrows FROM $dbname.clients";
$results=mysql_query($query) or die(mysql_error() .": $query");
$row=mysql_fetch_array($results, MYSQL_ASSOC);
$numrows=$row['numrows'];
$maxPage=ceil($numrows/$rowsPerPage);
$pageNum=1;
while ($pageNum<=$maxPage) {
	$offset=($pageNum-1)*$rowsPerPage;
	$query="SELECT $dbname.clients.company_name, $dbname.clients.last_name, $dbname.clients.first_name, $dbname.jobs.job_number, $dbname.jobs.job_desc, $dbname.jobs.fb_pg, $dbname.subdivisions.subdivision, $dbname.jobs.lot_blk
			FROM $dbname.jobs 
			LEFT JOIN $dbname.clients
			ON $dbname.jobs.client_id=$dbname.clients.client_id
			LEFT JOIN $dbname.subdivisions
			ON $dbname.jobs.subdivision_id=$dbname.subdivisions.subdivision_id
			ORDER BY $dbname.clients.company_name ASC, $dbname.clients.last_name ASC, $dbname.clients.first_name ASC
		    LIMIT $offset, $rowsPerPage";
	$results=mysql_query($query) or die(mysql_error() .": $query");
	//Start the page
	$pdf->AddPage();
	$pdf->AliasNbPages();
	$pdf->SetFont('Arial','B',18);
		$pdf->Cell(735,30,'ALPHABETICAL BY CLIENT',1,1,'C');
	$pdf->SetFont('Arial','B',;
		$pdf->Cell(100,15,'Company Name',1,0,'C');
		$pdf->Cell(70,15,'Last Name',1,0,'C');
		$pdf->Cell(70,15,'First Name',1,0,'C');
		$pdf->Cell(65,15,'Job Number',1,0,'C');
		$pdf->Cell(195,15,'Job Description',1,0,'C');
		$pdf->Cell(42,15,'FB/Pg',1,0,'C');
		$pdf->Cell(151,15,'Subdivision',1,0,'C');
		$pdf->Cell(42,15,'Lot/Blk',1,1,'C');
	$pdf->SetFont('Arial','',;
	$filltog=0;
	while($row=mysql_fetch_array($results)) {
		if ($filltog==0) { $pdf->SetFillColor(250,240,230); }
		else { $pdf->SetFillColor(236,198,159); }
		if($row['company_name']==NULL) { $pdf->Cell(100,15,'',1,0,'',1); }
		else { $pdf->Cell(100,15,$row['company_name'],1,0,'',1); }
		if($row['last_name']==NULL) { $pdf->Cell(70,15,'',1,0,'',1); }
		else { $pdf->Cell(70,15,$row['last_name'],1,0,'',1); }
		if($row['first_name']==NULL) { $pdf->Cell(70,15,'',1,0,'',1); }
		else { $pdf->Cell(70,15,$row['first_name'],1,0,'',1); }
		if($row['job_number']==NULL) { $pdf->Cell(65,15,'',1,0,'C',1); }
		else { $pdf->Cell(65,15,$row['job_number'],1,0,'C',1); }
		if($row['job_desc']==NULL) { $pdf->Cell(195,15,'',1,0,'',1); }
		else { $pdf->Cell(195,15,$row['job_desc'],1,0,'',1); }
		if($row['fb_pg']==NULL) { $pdf->Cell(42,15,'',1,0,'C',1); }
		else { $pdf->Cell(42,15,$row['fb_pg'],1,0,'C',1); }
		if($row['subdivision']==NULL) { $pdf->Cell(151,15,'',1,0,'',1); }
		else { $pdf->Cell(151,15,$row['subdivision'],1,0,'',1); }
		if($row['lot_blk']==NULL) { $pdf->Cell(42,15,'',1,1,'C',1); }
		else { $pdf->Cell(42,15,$row['lot_blk'],1,1,'C',1); }
		if ($filltog==0) { $filltog=1; }
		else { $filltog=0; }
	}
	$pageNum++;
        $pdf->Cell(0,15,'Report complied on '.$date,0,1,'R',0);
}
    $result=mysql_query("UPDATE $dbname.trackers SET datetime='$date' WHERE tracker_id='2'") or die(mysql_error());

include '../library/closedb.php';
$pdf->Output('rep_Aclient.pdf',F);
    $pdf->Output();
?>

 

The report only returns up to past page 113.  I know the query works as in Navicat it'll return everything correctly.  Why is this report stopping early?

Link to comment
https://forums.phpfreaks.com/topic/135218-help-with-php-fpdf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.