我在让 SQL 查询在 fpdf 中工作时遇到了一些麻烦,这甚至可能吗?
我目前有
session_start();
require('fpdf.php');
class PDF extends FPDF
{
function Header()
{
include('config.php');
$client_check = $db->prepare("SELECT * FROM clients WHERE client_fullname = '".$_SESSION['client_details']."'");
$client_check->execute();
while ($row = $client_check->fetch(PDO::FETCH_ASSOC))
{
$client_firstname = $row ['client_firstname'];
$client_lastname = $row ['client_lastname'];
$client_address = $row ['client_address'];
$client_jobaddress = $row ['client_jobaddress'];
$client_homephone = $row ['client_homephone'];
$this->SetFont('Arial', 'B', 12);
$this->Cell(10,0,'Ph(H):',0,0,'C');
$this->Cell(20,0,''.$client_homephone.'', 0,0,'C');
$this->Line(30,61,100,61);
$this->Cell(210,0,'Job No:',0,0,'C');
$this->Cell(-120,0,'Model:',0,0,'C');
$this->Line(110,61,200,61);
}
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',10);
$pdf->Output();
在我添加 while 循环之前,一切都运行良好。现在它只是向我吐出一个空白的pdf。我怎样才能解决这个问题?