我是 PHP 菜鸟,我不断收到此错误:
解析错误:语法错误,文件意外结束...
它指向的行位于最后一行。我的“header.php”声明了!DOCTYPE html,而我的“config.php”保存了数据库属性。
任何帮助将不胜感激。
<?php
include 'config.php';
include 'header.php';
?>
<div id='wrapper'>
<div style='height:50em;width:100%;z-index:10;margin-top:1em;text-align:left;'>
<table id='mainDPUtable'>
<th class='cen'>NUM</th>
<th class='cen'>TYP</th>
<th class='cen'>LVL</th>
<th class='cen'>Job No.</th>
<th class='cen'>Responsible</th>
<th class='cen'>Rep</th>
<th class='cen'>Initiated</th>
<th class='cen'>Age</th>
<th class='cen'>Part Number</th>
<th class='cen'>Qty</th>
<th class='cen'>Description</th>
<th class='cen'>Location</th>
<th class='cen'>Complete</th>
<?php
$db = new PDO("mysql:host=localhost;dbname=".$dbname.",".$user.",".$pswd);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$result = $db->prepare("SELECT NUM, TYP, LVL, JOBNO, RESP, REP, DATE_INITIATED, AGE, PARTNO, QTY, DESCRIPTION, LOC FROM ".$dbtable);
$result->execute();
while ($row = $result->fetch(PDO::FETCH_ASSOC)){
$num=$row["NUM"];
$typ=$row["TYP"];
$lvl=$row["LVL"];
$jobNo=$row["JOBNO"];
$resp=$row["RESP"];
$rep=$row["REP"];
$date_initiated=$row["DATE_INITIATED"];
$age=$row["AGE"];
$partNo=$row["PARTNO"];
$qty=$row["QTY"];
$description=$row["DESCRIPTION"];
$loc = $row["LOC"];
$comp=$row["COMP"];
?>
<tr>
<td><?php echo $num; ?></td>
<td><?php echo $typ; ?></td>
<td><?php echo $lvl; ?></td>
<td><?php echo $jobNo; ?></td>
<td><?php echo $resp; ?></td>
<td><?php echo $rep; ?></td>
<td><?php echo $date_initiated; ?></td>
<td><?php echo $age; ?></td>
<td><?php echo $partNo; ?></td>
<td><?php echo $qty; ?></td>
<td><?php echo $description; ?></td>
<td><?php echo $loc; ?></td>
<td><input type='button' id=<?php echo 'btn'.$num; ?> value='Complete'/></td>
</tr>
<?php}?>
</table>
</div>
</div>
</body>
</html>