问题如下:Warning: Cannot add header information - headers already sent by (output started at D:\www\test_o.php:1) in D:\www\test_o.php on line 7

解决方案 »

  1.   

    信息头已经送出了。Header("Location: ./index.htm");
      exit;可以去掉exit;
      

  2.   

    说明你前面的$conn=ocilogon("scott","tiger","system"); if (($id!="") and ($content!="")) {
    $query="INSERT into sms_yy(id,content,length,author,sendtime,comments) values('$id', '$content', '$length', '$author', '$sendtime', '$comments')";不起作用
    只要echo$query是否有值再作决定
      

  3.   

    <?phpif ($id!="")  {
      putenv("ORACLE_SID=oracle");
      putenv("NLS_LANG=american_taiwan.zht16big5");
      
      $handle=ora_logon("system","tiger") or die;
      $cursor=ora_open($handle);
      ora_commitoff($handle);
      
      $query="INSERT into sms_yy(id,content,author,comment) values('$id', '$content', '$author', '$comment' )";
      ora_parse($cursor, $query) or die;
      ora_exec($cursor);
      ora_close($cursor);
      ora_logoff($handle);
      Header("Location: addmsg.php");
      exit;} else {
    ?><html>
    <head>
    <title>成功写入</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body bgcolor="#FFFFFF" text="#000000">
    <table width="80%" border="0" cellspacing="0" cellpadding="0" height="58">
      <tr bgcolor="#0066FF" bordercolor="#FFFFFF"> 
        <td width="21%" height="2"> 
          <div align="center"><font color="#FFFFFF">短语代码</font></div>
        </td>
        <td width="25%" height="2"> 
          <div align="center"><font color="#FFFFFF">内容</font></div>
        </td>
        <td width="27%" height="2"> 
          <div align="center"><font color="#FFFFFF">短语作者</font></div>
        </td>
        <td width="27%" height="2"> 
          <div align="center"><font color="#FFFFFF">备注</font></div>
        </td>
      </tr>
      <tr> 
        <td height="15" width="21%"> 
          
          <div align="center"><?="$id"?></div>
        </td>
        <td height="15" width="25%"> 
         
          <div align="center"> <?="$content"?></div>
        </td>
        <td height="15" width="27%"> 
          
          <div align="center"><?="$author"?></div>
        </td>
        <td height="15" width="27%"> 
          
          <div align="center"><?="$comments"?></div>
        </td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    }
    ?>
    错误如下:
    Warning: Oracle: Connection Failed: ORA-12560: TNS:协议适配器错误 in D:\www\xxx\add.php on line 7