错误:文档末尾的额外内容下面是第一个错误之前的页面呈现

时间:2012-12-19 01:08:23

标签: php html mysql

确切的错误

This page contains the following errors:
error on line 3 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

我的PHP文件

 <?php
 header( 'Content-type: text/xml' );
 mysql_connect( "mysql3.000webhost.com", "Username", "Password" );
 mysql_select_db( 'Ddb' );
 mysql_query( "INSERT INTO items VALUES ( null, null, '".
 mysql_real_escape_string( $_REQUEST['user'] ).
 "', '".
 mysql_real_escape_string( $_REQUEST['message'] ).
 "')" );
?>
<success/>

我的HTML文件(我不认为这与错误有任何关系。)

<html>
 <head>
  <title>Add Definition Form</title>
 </head>
 <body>
  <form action="add.php" method="POST">
    User: <input name="user" /><br />
    Message: <input name="message" /><br />
    <input type="submit" />
  </form>
 </body>
</html>
所有文件上的

chmod 777(我知道这很糟糕,但该网站尚未公开)。

评论是否需要更多信息。

教程我正在关注http://www.ibm.com/developerworks/library/x-ioschat/index.html#l3ioschat/index.html#l3

1 个答案:

答案 0 :(得分:1)

完全遵循IBM文档中提到的那一点。我已在http://nixblog.webatu.com/test.html上传了一个测试页,但它确实有效。

所以不确定你做错了什么。

根据示例,数据库表插入用于表'chatitems',您似乎正在使用'items'。只需确保您插入的内容是正确的,并且它不会显示任何数据库错误。要做的是将'Content-type:text / xml'更改为'Content-type:text'