解析错误:帮我解决我的php错误

时间:2016-12-05 04:07:47

标签: php html mysql sql

我收到的错误是:

  

解析错误:语法错误,第38行/home/Jones/public_html/Assignment4/listCar.php中的意外$ end

然而,第38行没有任何内容..谢谢          

$sql = "SELECT * FROM CARS";
//Get the result set
$result = mysql_query($sql);
//Show the result using while statement and a html table tag
?>
<table border =1>
<tr>
<td> ID </td>
<td> Make </td>
<td> Model </td>
<td> Year </td>
<td> Mileage </td>
<td> First Name </td>
<td> Last Name </td>
<td> Email </td>
</tr>
<?php
while($row = mysql_fetch_array($result)){
echo $row ['ID'];
echo $row['MAKE'];
echo $row['MODEL'];
echo $row[YEAR];
echo $row[MILE];
echo $row['FNAME'];
echo $row['LNAME'];
echo $row['EMAIL'];


?>
}
</html>

1 个答案:

答案 0 :(得分:1)

        <?php
       while($row = mysql_fetch_array($result)){
         echo $row ['ID'];
      echo $row['MAKE'];
       echo $row['MODEL'];
        echo $row[YEAR];
      echo $row[MILE];
        echo $row['FNAME'];
        echo $row['LNAME'];
       echo $row['EMAIL'];
       ?>
         }

将其更改为此

       <?php
        while($row = mysql_fetch_array($result)){
         echo $row ['ID'];
        echo $row['MAKE'];
        echo $row['MODEL'];
       echo $row[YEAR];
      echo $row[MILE];
     echo $row['FNAME'];
       echo $row['LNAME'];
        echo $row['EMAIL'];

    }
         ?>

您在}之后放置了?>括号,这会给您带来意外错误。