我有这个错误,使用FPDF将MySql表提取为PDF。
它只显示3个纵向格式的列,我在其中传递一般查询,该查询应显示所有列。
我需要专家建议如何解决这个问题。
我的代码是:
<?php
require_once("dbcontroller.php");
$db_handle = new DBController();
$result = $db_handle->runQuery("SELECT * FROM icard");
$header = $db_handle->runQuery("SELECT `COLUMN_NAME` FROM
`INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='blog_samples' AND
`TABLE_NAME`='icard'");
require('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
foreach($header as $heading) {
foreach($heading as $column_heading)
$pdf->Cell(90,12,$column_heading,1);
}
foreach($result as $row) {
$pdf->SetFont('Arial','',12);
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(90,12,$column,1);
}
$pdf->Output();
?>
当我运行此脚本时,它只获取3列。我有10列需要获取 - 我该怎么办?
如果您有任何想法,请帮助我