跟着视频教程打的,但教程弄出来的是对的,我弄出来就是错的<?php
 include("conn.php");?>
<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select*from message";
$query=mysql_query($sql);while($row=mysql_fetch_array($query)){
?>
  <tr bgcolor="#eff3ff">
  <td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
  </tr>
  <tr bgColor="#ffffff">
  <td>内容:<?=$row[content]?></td>
  </tr>
  <?
   }
  ?>
  </table>
Parse error: syntax error, unexpected $end in D:\wamp\www\bbs2\list.php on line 29

解决方案 »

  1.   

    显示第29行错了,但是你这个明明没有29行啊,我寻思着你这个以</table>结束了是不是招致语法错误了,应该还是在收尾加上<html><head></head><body>............</body></html>才行哦。另外,倒数第四行问号后面少了个"php"啊。
      

  2.   

    首先对于<? ?>标签需要开启php.ini里面的short_open_tag = On,其次你不细心,类似这种<?=$row[content]?>分号哪里去了? 养成习惯用<?php ?>,没坏处的,而且注意自己的程序写法规范,基本的东西要多练。
      

  3.   

    標籤要統一,既然開始你在用<?php為什麽後邊又在用<?這種短標籤呢,如果你的php沒有配置短標籤這是會出錯的,另外儘量不要html和php混排,那會效率低下
    <?php
     include("conn.php");Echo '<table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">';
    $sql="select * from message";
    $query=mysql_query($sql);while($row=mysql_fetch_array($query)){
    Echo '<tr bgcolor="#eff3ff">';
    Echo '<td>标题:',$row[title],' 用户:',$row[user],'</td>';
    Echo '</tr><tr bgColor="#ffffff">';
    Echo '<td>内容:',$row[content],'</td></tr>';
    }Echo '</table>';?>
      

  4.   

    <?=$row[title]?> 
    这种形式是老的规范,新规范:
    <?PHP echo $row[title] ; ?> 
      

  5.   

    $row[title]
    $row[user]
    $row[content]要改成:
    $row['title']
    $row['user']
    $row['content']
      

  6.   

    unexpected $end    看看包含文件中是不是有个未赋值的变量:$end;
      

  7.   

    $row[content]
     加上引号:$row['content']
      

  8.   

    原有代码改为
    <?php
     include("conn.php");?>
    <table width=500 border="0"align="center"cellpadding="5" cellspacing="1" bgcolor="#add3ef">
    <?php
    $sql="select*from message";
    $query=mysql_query($sql);while($row=mysql_fetch_array($query)){
    ?>
      <tr bgcolor="#eff3ff">
      <td>标题:<?php echo $row[title]?> 用户:<?php echo $row[user]?></td>
      </tr>
      <tr bgColor="#ffffff">
      <td>内容:<?php echo $row[content]?></td>
      </tr>
      <?php
      }
      ?>
      </table>
    即可,你遇到的问题是因为短标签的问题,不建议使用<??>这种方式,应该使用<?php ?>这种风格