...

View Full Version : CReate Multiple PDF Documents With PHP While



cswart777
09-01-2011, 07:33 PM
Please assist, im trying to create a script that will automatically generate a pdf document and then move to next record and generate a new pdf based on the data,
when i run the script the browser displays a blank page.

<?php
mysql_select_db($database_traces, $traces);
$query_rsTraceps = "SELECT * FROM traceps ORDER BY sfref";
$rsTraceps = mysql_query($query_rsTraceps, $traces) or die(mysql_error());
$row_rsTraceps = mysql_fetch_assoc($rsTraceps);
while ($row_rsTraceps = mysql_fetch_array($rsTraceps))
{
$value1 = $row_rsTraceps['sfref'];
require ('fpdf.php');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf -> AddPage();
$pdf -> SetFont ('Arial','B', 10);
$pdf-> Image('traceps.jpg',10,6,50);
$pdf -> Ln(40);
$pdf -> Cell (25,5,"Reference :");
$pdf -> Cell (80,5,$row_rsTraceps['sfref'] ,1);
$pdf -> Ln(10);
}

dnnhater
09-01-2011, 08:05 PM
<?php
mysql_select_db($database_traces, $traces);
$query_rsTraceps = "SELECT * FROM traceps ORDER BY sfref";
$rsTraceps = mysql_query($query_rsTraceps, $traces) or die(mysql_error());
$row_rsTraceps = mysql_fetch_assoc($rsTraceps);
while ($row_rsTraceps = mysql_fetch_array($rsTraceps))
{
$value1 = $row_rsTraceps['sfref'];
require ('fpdf.php');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf -> AddPage();
$pdf -> SetFont ('Arial','B', 10);
$pdf-> Image('traceps.jpg',10,6,50);
$pdf -> Ln(40);
$pdf -> Cell (25,5,"Reference :");
$pdf -> Cell (80,5,$row_rsTraceps['sfref'] ,1);
$pdf -> Ln(10);
}

in the snippet you've provided there is no closing php tag - ?>

Inigoesdr
09-02-2011, 05:12 AM
in the snippet you've provided there is no closing php tag - ?>

A closing tag is not required and often times people omit them intentionally to prevent spaces at the end of the file from causing the headers to be sent prematurely. This thread is a dupe, though. Closing.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum