Web Analytics Made Easy -
StatCounter CReate Multiple PDF Documents With PHP While - CodingForum

Announcement

Collapse
No announcement yet.

CReate Multiple PDF Documents With PHP While

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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 - ?>

    Comment


    • #3
      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.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎