这是我根据来宾表详细信息创建报告的代码。但它会出现以下错误。
第17行/home/a5899527/public_html/cpanel/testrep2.php中解析错误:语法错误,意外')'
<?php
include("connect.php");
$SQL="SELECT * FROM guest ";
$run=mysql_query($SQL,$con) or die ("SQL error");
$row=mysql_fetch_array($run);
require('/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($row) {
$pdf->SetFont('Arial','',12);
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(90,12,$column,1);
}
$pdf->Output();
?>
请给出解决方案? 第17行是foreach($ row){
答案 0 :(得分:0)
将;
放在$row=mysql_fetch_array($run)
foreach($row) { // here you didn't use 'as'
$pdf->SetFont('Arial','',12);
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(90,12,$column,1);
}
像这样更改您的代码。
$pdf->SetFont('Arial','',12);
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(90,12,$column,1);
}