0

我想从数据库中检索特定销售人员的数据,并使用以下代码下载在 pdf file.im 中检索的数据,它仅显示页面的结构和页面的标题,而不是我想要的表格中的详细信息。任何人帮助我

这是代码:

 <?php

 include "test4.php";
 include('fpdf/fpdf.php');
 $pdf=new FPDF();

 //Creating new pdf page
 $pdf->AddPage();


  $pdf->SetRightMargin(50);
  $margin;

  // Insert a logo in the top-left corner at 300 dpi
  $pdf->Image('images/logo7.png',5,5,-100);
  // Insert a dynamic image from a URL
  $pdf->Ln(20);

  $pdf->Ln();
  //Set the base font & size
  $pdf->SetFont('Arial','B',18); 
  $pdf->Cell(200,5,"Booth Sales Reports",0,0,'C');
  //Creating new line
  $pdf->Ln();
  $pdf->Ln();
  $pdf->SetFont('Arial','i',12);
  $pdf->Cell(40,10,"Company Name",0,'C');
  $pdf->Cell(40,10,"Contact Person",0,'C');



 $pdf->Cell(40,10,"Booth Number",0,'C');

 $pdf->Cell(40,10,"Phone Number",0,'C');

 $pdf->Cell(30,10,"Date",0,'C');
 $pdf->Ln();
         $pdf->Cell(200,-2,"__________________________________");



   // Fetch data from table
     $c=$_SESSION['user'];
     $result=mysql_query("SELECT  `company_name`, `contact_person`,  `phone_number`, `booth_number`, `date` FROM `registration1` where 'sold_by' ='$c' ");
    while($row=mysql_fetch_array($result))
  {
  $pdf->Cell(40,5,"{$row['company_name']}",1,0,'C');
  $pdf->Cell(40,5,"{$row['contact_person']}",1,0,'C');




  $pdf->Cell(40,5,"{$row['phone_number']}",1,0,'C');

  $pdf->Cell(40,5,"{$row['booth_number']}",1,'C');

  $pdf->multiCell(30,5,"{$row['date']}",1,'C');
  }
 $pdf->Output();
  ?>

这个编码什么也没显示

4

2 回答 2

0
$result=mysql_query("SELECT  `company_name`, `contact_person`,  `phone_number`, `booth_number`, `date` FROM `registration1` where 'sold_by' ='$c' ");
while($row=mysql_fetch_array($result))
{
    $pdf->Cell(40,5,$row['company_name'],1,0,'C');
    $pdf->Cell(40,5,$row['contact_person'],1,0,'C');
    $pdf->Cell(40,5,$row['phone_number'],1,0,'C');
    $pdf->Cell(40,5,$row['booth_number'],1,'C');
    $pdf->multiCell(30,5,$row['date'],1,'C');
}

尝试这个

于 2013-10-14T10:55:01.787 回答
0

去那里:fpdf.org,然后是 Scripts -> Table with Mysql。那应该可以解决您的问题 http://fpdf.org/en/script/script14.php

于 2013-10-14T10:42:50.730 回答