Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    CReate Multiple PDF Documents With PHP While

    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);
    }

  • #2
    New Coder
    Join Date
    Jul 2011
    Location
    Sunshine State
    Posts
    80
    Thanks
    18
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?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 - ?>

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by dnnhater View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •