能说详细点吗?
但是我之前是运行好的程序阿。而且只是一个很简单的echo程序而已。
我不懂什么发送什么报头。我刚接触PHP两天而已。

解决方案 »

  1.   

    我刚接触PHP两天.
    我只是照着书上做了一个简单的问候程序
    之前一直是好着的,我刚换了PHP4.3.4,就出现上面的提示
    会不会是我版本或配置的原因?
      

  2.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <form method="post" action="hello.php">
    <input name="user_name" type="text" id="user_name" size="25" maxlength="16">
    <?php
          if($error=="1"){
       echo "<font style='FONT-SIZE:16px' color='#FF0000'><b>";
          echo "这个名字已经存在于数据库中了!";
      echo "</b></font>";}
      ?>
    <input type="submit" name="Submit" value="提交">
    </form>
    </body>
    </html>
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    hello.php
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <?php
    $host="localhost";
    $user="root";
    $password="";
    $dbname="info";mysql_connect("$host","$user","") or die("无法连接MySQL数据库服务器!"); 
    $db=mysql_select_db("$dbname") or die("无法连接数据库!");$sql="select user_id from user where user_name='$user_name'";
    $result=mysql_db_query("info",$sql);
    $num=mysql_num_rows($result);
    if($num<>0){
        header("Location:reg.php?error=1");}
    else{
    echo"检测通过!";}
    ?>
    </body>
    </html>
      

  3.   

    http://csdn.net/Develop/article/25/25618.shtmhttp://csdn.net/develop/Read_Article.asp?Id=22285
    可以参考一下.
      

  4.   

    把除了下面的代码之处的HTML标记全去掉
    <?php
    $host="localhost";
    $user="root";
    $password="";
    $dbname="info";mysql_connect("$host","$user","") or die("无法连接MySQL数据库服务器!"); 
    $db=mysql_select_db("$dbname") or die("无法连接数据库!");$sql="select user_id from user where user_name='$user_name'";
    $result=mysql_db_query("info",$sql);
    $num=mysql_num_rows($result);
    if($num<>0){
        header("Location:reg.php?error=1");}
    else{
    echo"检测通过!";}
    ?>
      

  5.   

    代码没有问题.你看下php.ini里面的配置.或把你的php.ini贴出来.
      

  6.   

    if($num<>0){
        header("Location:reg.php?error=1");}
    else{
    echo"检测通过!";}
    在php程序中header不能有任何输入既包括html文档或者echo ,print等。这个转向你可以用javascript实现阿。
    我是感觉那个header不太好用。
      

  7.   

    谢谢大家的帮忙,问题已经搞定了:)
    不是配置的问题,是我的代码写得不规范,换到最新的版本就出现问题了。看来我首先就是要解决我的编程习惯问题了。PS:sai1691(saihong) 我之前用的是4.3.2