Jump to content

PDF error


fred12ned

Recommended Posts

[code]<?php
define('FPDF_FONTPATH','font/');
require('fpdf.php');
include("connections/WIll.php");

$result = mysql_query("SELECT * FROM test");
$number_of_products = mysql_num_rows($result);

$column_user = "";
$column_pass = "";
$column_lvl = "";

while($row = mysql_fetch_array($result))
{
    $user = $row["user"];
    $pass = substr($row["pass"],0,20);
    $real_lvl = $row["lvl"];
    $lvl_to_show = $row["lvl"];

    $column_user = $column_user.$user."\n";
    $column_pass = $column_pass.$pass."\n";
    $column_lvl = $column_lvl.$lvl_to_show."\n";

}
mysql_close();

$pdf=new FPDF();
$pdf->Open();
$pdf->AddPage();

$Y_Fields_Name_position = 20;

$Y_Table_Position = 26;


$pdf->SetFillColor(232,232,232);

$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(45);
$pdf->Cell(20,6,'user',1,0,'L',1);
$pdf->SetX(65);
$pdf->Cell(100,6,'pass',1,0,'L',1);
$pdf->SetX(135);
$pdf->Cell(30,6,'lvl',1,0,'R',1);
$pdf->Ln();


$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(45);
$pdf->MultiCell(20,6,$column_user,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(65);
$pdf->MultiCell(100,6,$column_pass,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(135);
$pdf->MultiCell(30,6,$columna_lvl,1,'R');


$i = 0;
$pdf->SetY($Y_Table_Position);
while ($i < $number_of_products)
{
    $pdf->SetX(45);
    $pdf->MultiCell(120,6,'',1);
    $i = $i +1;
}

$pdf->Output();
?>[/code]

I loads the pdf but with no data like

|USER|PASS|
|____|_____|
|____|_____|
|____|_____|
|____|_____|

Can any spot anything wrong

Thanks in advance,

Will
Link to comment
https://forums.phpfreaks.com/topic/28648-pdf-error/
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.