conn.php
<?php/*
 * PHP100Job v1.0
 * Programmer : Msn/QQ [email protected] (925939)
 * www.php100.com Develop a project PHP - MySQL - Apache
 * Window 2003 - Preferences - PHPeclipse - PHP - Code Templates
 */$conn = @ mysql_connect("localhost", "root", "dong") or die("数据库链接错误");
mysql_select_db("news", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;function htmtocode($content) {
$content = str_replace("\n", "<br>", str_replace(" ", "&nbsp;", $content));
return $content;
}//$content=str_replace("'","‘",$content);
 //htmlspecialchars();
 ?><?php/*
 * PHP100Job v1.0
 * Programmer : Msn/QQ [email protected] (925939)
 * www.php100.com Develop a project PHP - MySQL - Apache
 * Window 2003 - Preferences - PHPeclipse - PHP - Code Templates
 */
 include("conn.php"); include("head.php");
  $SQL="SELECT * FROM `message` order by id desc";
  $query=mysql_query($SQL);
  while($row=mysql_fetch_array($query)){
?><table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
  <tr bgcolor="#eff3ff">
  <td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
  </tr>
  <tr bgColor="#ffffff">
  <td>内容:<?
 echo htmtocode($row[content]);
  ?></td>
  </tr>
</table>
<?
  }
?>
运行出现下边的错误
Parse error: syntax error, unexpected $end in E:\wamp\www\leave_message\list.php on line 35 帮忙解决,不胜感激

解决方案 »

  1.   

    你开启段标记了吗? 没开的话不能那么写。为了更规范点: 写成<?php echo $row['title'];?> 后面一样。
      

  2.   

    E:\wamp\www\leave_message\list.php on line 35
    这附近的代码发出来看看
      

  3.   

    楼主要注意,错误的是list.php
      

  4.   

    在php.ini中找到short_open_tag 设为on
      

  5.   

    我按照你的提示做了,可是php.ini 里的short_open_tag=on,但是还是不行,你帮我修改,能不能把段标记取了,就是比较规范的那种的,谢谢
      

  6.   

    你把标题、内容,用户那三个改成<?php echo $row['title'];?>这样的就行了啊。函数就<?php echo htmtocode($row[content]); ?>  
      

  7.   

    这不是主要的,至多只是显示不出数据
    报错的原因在这里
    <?
      }
    ?>
    改成
    <?php
      }
    ?>
      

  8.   

    这样也不行,不知道你在php编辑软件上运行过么,我改了,可问题还是这样,