หน้าเว็บขึ้น Parse error: syntax error, unexpected end of file in C:\AppServ\www\splitterdb\testpdf.php on line 75 แก้ไขยังไงค่ะ
Code (PHP)
<?php
require("fpdf/fpdf.php");
class PDF extends FPDF
{
function Header(){
//$this->SetY( -10 );
//$this->SetFont('Arial','I',5);
// $this->Cell(0,10,'Time '. date('d').'/'. date('m').'/'.( date('Y')+543 ).' '. date('H:i:s') ,0,0,'R');
}
}
define("FPDF_FONTPATH","font/");
$pdf=new FPDF( 'L' , 'mm' , 'A4' );
$pdf->SetMargins( 30,30,30 );
$pdf->AddPage();
$pdf->Image('fpdf/cat.jpg',135,12,30,0,'','');
$pdf->AddFont('angsa','','angsa.php');
$pdf->SetFont('angsa','',20);
$pdf->Cell(0,20,iconv( 'UTF-8','TIS-620','รายงานการใช้งานอุปกรณ์ PE ()'),0,1,"C");
//$pdf->Ln();
$pdf->Cell(0,1,iconv( 'UTF-8','TIS-620','สำนักงานบริการลูกค้า กสท เขตกลาง'),0,1,"C");
$pdf->SetFontSize(10);
$html = "
<table border= 1>
<tr>
<th width=90>Region</th>
<th width=90>Brand</th>
<th width=120>Model </th>
<th width=97>SiteName</th>
<th width=95>HostName </th>
<th width=91>IP</th>
<th width=150>Typesite</th>
<th width=91>Locality</th>
<th width=91>District</th>
<th width=91>Province</th>
<th width=91>Lat</th>
<th width=91>Long</th>
<th width=91>Recorder</th>
<th width=91>Edit Day</th>
</tr> ";
@mysql_connect("localhost","root","product1000 ") or die(mysql_error());
mysql_select_db("splitterdb") or die(mysql_error());
$sqlMain = "SELECT pe.pe_id,pe.region,pe.brand_id,b.bname,pe.model_id,m.mname,pe.sitename,pe.hostname,pe.ip,
pe.ts_id,ts.tsname,pe.locality,pe.dist_id,d.dname,pe.province,pe.latitude,pe.longitude,pe.username,pe.editday
FROM pe INNER JOIN (brand b,model m,typesite ts,district d)
ON (pe.brand_id=b.brand_id AND pe.model_id=m.model_id AND pe.ts_id=ts.ts_id AND pe.dist_id=d.dist_id)
WHERE pe.region='".$_SESSION["viewregion"]."'
ORDER BY pe.province,d.dname,pe.model_id";
$qryMain = mysqli_query($conn,$sqlMain);
$resMain = mysqli_fetch_array($qryMain);
while($sql = mysqli_fetch_array($resMain)) {
$html .= "<tr>
<td width=90>{$sql['region']}</td>
<td width=90>{$sql['brand_id']}</td>
<td width=120>{$sql['model_id']}</td>
<td width=97>{$sql['sitename']}</td>
<td width=95>{$sql['hostname']}</td>
<td width=91>{$sql['ip']}</td>
<td width=150>{$sql['tsname']}</td>
<td width=91>{$sql['locality']}</td>
<td width=91>{$sql['dname']}</td>
<td width=91>{$sql['province']}</td>
<td width=91>{$sql['latitude']}</td>
<td width=91>{$sql['longitude']}</td>
<td width=91>{$sql['username']}</td>
<td width=91>{$sql['editday']}</td>
<tr> }
</table>" ;
$pdf->WriteHTML($html);
$pdf->Output($html);
?>
Tag : PHP, MySQL, Web (ASP.NET)
Date :
2016-09-02 15:15:50
By :
jame275
View :
2628
Reply :
4
syntax error แปลว่า เขียนผิดรูปแบบ
และ error บอกว่าบรรทัด 75 ลองหาดู ที่บรรทัดนั้น เขียนอะไรผิดสักอย่าง ดูตั้งแต่ 74,75,76 เลย
Date :
2016-09-02 16:13:04
By :
goragod
Code (PHP)
while($sql = mysqli_fetch_array($resMain)) {
$html .= "<tr>
<td width=90>{$sql['region']}</td>
<td width=90>{$sql['brand_id']}</td>
<td width=120>{$sql['model_id']}</td>
<td width=97>{$sql['sitename']}</td>
<td width=95>{$sql['hostname']}</td>
<td width=91>{$sql['ip']}</td>
<td width=150>{$sql['tsname']}</td>
<td width=91>{$sql['locality']}</td>
<td width=91>{$sql['dname']}</td>
<td width=91>{$sql['province']}</td>
<td width=91>{$sql['latitude']}</td>
<td width=91>{$sql['longitude']}</td>
<td width=91>{$sql['username']}</td>
<td width=91>{$sql['editday']}</td>
<tr> ";
}
"</table>" ;
Date :
2016-09-02 16:23:09
By :
kimhuncodec
ผิดเพราะเอา } ไปไว้ใน " หลัง </tr>
แก้เป็น
Code (PHP)
<?php
require("fpdf/fpdf.php");
class PDF extends FPDF
{
function Header(){
//$this->SetY( -10 );
//$this->SetFont('Arial','I',5);
// $this->Cell(0,10,'Time '. date('d').'/'. date('m').'/'.( date('Y')+543 ).' '. date('H:i:s') ,0,0,'R');
}
}
define("FPDF_FONTPATH","font/");
$pdf=new FPDF( 'L' , 'mm' , 'A4' );
$pdf->SetMargins( 30,30,30 );
$pdf->AddPage();
$pdf->Image('fpdf/cat.jpg',135,12,30,0,'','');
$pdf->AddFont('angsa','','angsa.php');
$pdf->SetFont('angsa','',20);
$pdf->Cell(0,20,iconv( 'UTF-8','TIS-620','รายงานการใช้งานอุปกรณ์ PE ()'),0,1,"C");
//$pdf->Ln();
$pdf->Cell(0,1,iconv( 'UTF-8','TIS-620','สำนักงานบริการลูกค้า กสท เขตกลาง'),0,1,"C");
$pdf->SetFontSize(10);
$html = "
<table border= 1>
<tr>
<th width=90>Region</th>
<th width=90>Brand</th>
<th width=120>Model </th>
<th width=97>SiteName</th>
<th width=95>HostName </th>
<th width=91>IP</th>
<th width=150>Typesite</th>
<th width=91>Locality</th>
<th width=91>District</th>
<th width=91>Province</th>
<th width=91>Lat</th>
<th width=91>Long</th>
<th width=91>Recorder</th>
<th width=91>Edit Day</th>
</tr> ";
@mysql_connect("localhost","root","product1000 ") or die(mysql_error());
mysql_select_db("splitterdb") or die(mysql_error());
$sqlMain = "SELECT pe.pe_id,pe.region,pe.brand_id,b.bname,pe.model_id,m.mname,pe.sitename,pe.hostname,pe.ip,
pe.ts_id,ts.tsname,pe.locality,pe.dist_id,d.dname,pe.province,pe.latitude,pe.longitude,pe.username,pe.editday
FROM pe INNER JOIN (brand b,model m,typesite ts,district d)
ON (pe.brand_id=b.brand_id AND pe.model_id=m.model_id AND pe.ts_id=ts.ts_id AND pe.dist_id=d.dist_id)
WHERE pe.region='".$_SESSION["viewregion"]."'
ORDER BY pe.province,d.dname,pe.model_id";
$qryMain = mysqli_query($conn,$sqlMain);
$resMain = mysqli_fetch_array($qryMain);
while($sql = mysqli_fetch_array($resMain)) {
$html .= "<tr>
<td width=90>{$sql['region']}</td>
<td width=90>{$sql['brand_id']}</td>
<td width=120>{$sql['model_id']}</td>
<td width=97>{$sql['sitename']}</td>
<td width=95>{$sql['hostname']}</td>
<td width=91>{$sql['ip']}</td>
<td width=150>{$sql['tsname']}</td>
<td width=91>{$sql['locality']}</td>
<td width=91>{$sql['dname']}</td>
<td width=91>{$sql['province']}</td>
<td width=91>{$sql['latitude']}</td>
<td width=91>{$sql['longitude']}</td>
<td width=91>{$sql['username']}</td>
<td width=91>{$sql['editday']}</td>
<tr>";
}
$html . = "</table>" ;
$pdf->WriteHTML($html);
$pdf->Output($html);
?>
Date :
2016-09-02 16:28:20
By :
(- - ')
เอาใหม่ ต้องเป็น </tr>
Code (PHP)
<?php
require("fpdf/fpdf.php");
class PDF extends FPDF
{
function Header(){
//$this->SetY( -10 );
//$this->SetFont('Arial','I',5);
// $this->Cell(0,10,'Time '. date('d').'/'. date('m').'/'.( date('Y')+543 ).' '. date('H:i:s') ,0,0,'R');
}
}
define("FPDF_FONTPATH","font/");
$pdf=new FPDF( 'L' , 'mm' , 'A4' );
$pdf->SetMargins( 30,30,30 );
$pdf->AddPage();
$pdf->Image('fpdf/cat.jpg',135,12,30,0,'','');
$pdf->AddFont('angsa','','angsa.php');
$pdf->SetFont('angsa','',20);
$pdf->Cell(0,20,iconv( 'UTF-8','TIS-620','รายงานการใช้งานอุปกรณ์ PE ()'),0,1,"C");
//$pdf->Ln();
$pdf->Cell(0,1,iconv( 'UTF-8','TIS-620','สำนักงานบริการลูกค้า กสท เขตกลาง'),0,1,"C");
$pdf->SetFontSize(10);
$html = "
<table border= 1>
<tr>
<th width=90>Region</th>
<th width=90>Brand</th>
<th width=120>Model </th>
<th width=97>SiteName</th>
<th width=95>HostName </th>
<th width=91>IP</th>
<th width=150>Typesite</th>
<th width=91>Locality</th>
<th width=91>District</th>
<th width=91>Province</th>
<th width=91>Lat</th>
<th width=91>Long</th>
<th width=91>Recorder</th>
<th width=91>Edit Day</th>
</tr> ";
@mysql_connect("localhost","root","product1000 ") or die(mysql_error());
mysql_select_db("splitterdb") or die(mysql_error());
$sqlMain = "SELECT pe.pe_id,pe.region,pe.brand_id,b.bname,pe.model_id,m.mname,pe.sitename,pe.hostname,pe.ip,
pe.ts_id,ts.tsname,pe.locality,pe.dist_id,d.dname,pe.province,pe.latitude,pe.longitude,pe.username,pe.editday
FROM pe INNER JOIN (brand b,model m,typesite ts,district d)
ON (pe.brand_id=b.brand_id AND pe.model_id=m.model_id AND pe.ts_id=ts.ts_id AND pe.dist_id=d.dist_id)
WHERE pe.region='".$_SESSION["viewregion"]."'
ORDER BY pe.province,d.dname,pe.model_id";
$qryMain = mysqli_query($conn,$sqlMain);
$resMain = mysqli_fetch_array($qryMain);
while($sql = mysqli_fetch_array($resMain)) {
$html .= "<tr>
<td width=90>{$sql['region']}</td>
<td width=90>{$sql['brand_id']}</td>
<td width=120>{$sql['model_id']}</td>
<td width=97>{$sql['sitename']}</td>
<td width=95>{$sql['hostname']}</td>
<td width=91>{$sql['ip']}</td>
<td width=150>{$sql['tsname']}</td>
<td width=91>{$sql['locality']}</td>
<td width=91>{$sql['dname']}</td>
<td width=91>{$sql['province']}</td>
<td width=91>{$sql['latitude']}</td>
<td width=91>{$sql['longitude']}</td>
<td width=91>{$sql['username']}</td>
<td width=91>{$sql['editday']}</td>
</tr>";
}
$html . = "</table>" ;
$pdf->WriteHTML($html);
$pdf->Output($html);
?>
Date :
2016-09-02 16:29:44
By :
(- - ')
Load balance : Server 03