0

This is my code to create a report from details of guest table. but it gives following error.

Parse error: syntax error, unexpected ')' in /home/a5899527/public_html/cpanel/testrep2.php on line 17

<?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();
?>

please give a solution? Line 17 is foreach($row) {

1 Answers1

0

put ; here $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);
}

change your code like this.

$pdf->SetFont('Arial','',12);   
$pdf->Ln();
foreach($row as $column)
 $pdf->Cell(90,12,$column,1);
}
Archish
  • 850
  • 8
  • 32