在使用header的时候前头已经有HTML之类的语句输出了,提示说得很明白headers already sent by...

解决方案 »

  1.   

    feyge(菲戈..原来天空真的不止井口这么大呀~) 
    这我也看懂一点,就是不知我的代码里在哪里出了问题(已经有HTML之类的语句输出了),
      

  2.   

    <?php session_start();?>
    <?php if (isset($_SESSION['username'])): 
              { if ($_SESSION['username']=="shining"):
            else:
               {$msg=$_SESSION['username']."你不是管理员无权进行管理!!";
                    header("Location:msg.php?msg=$msg");}
                endif;}
       else:
           {$msg="你还没有登陆系统,请先登陆系统!!";
               header("Location:userlogin.php?msg=$msg");}
       endif;?>
    <?php require_once('Connections/localhost.php'); ?> 
    第13行:<?php 
    $currentPage = $HTTP_SERVER_VARS["PHP_SELF"];function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    if ((isset($HTTP_GET_VARS['Asset_ID'])) && ($HTTP_GET_VARS['Asset_ID'] != "")) {
      $deleteSQL = sprintf("DELETE FROM assettb WHERE Asset_ID=%s",
                           GetSQLValueString($HTTP_GET_VARS['Asset_ID'], "text"));  mysql_select_db($database_localhost, $localhost);
      $Result1 = mysql_query($deleteSQL, $localhost) or die(mysql_error());
      
      $deleteSQL1 = sprintf("DELETE FROM nominateassettb WHERE Asset_ID=%s",
                           GetSQLValueString($HTTP_GET_VARS['Asset_ID'], "text"));
      mysql_select_db($database_localhost, $localhost);
      $Result2 = mysql_query($deleteSQL1, $localhost) or die(mysql_error());}if ((isset($HTTP_GET_VARS['AssetID'])) && ($HTTP_GET_VARS['AssetID'] != "")) {
      $selectSQL = sprintf("select * FROM nominateassettb WHERE Asset_ID=%s",
                           GetSQLValueString($HTTP_GET_VARS['AssetID'], "text"));
      mysql_select_db($database_localhost, $localhost);
      $Result1 = mysql_query($selectSQL, $localhost) or die(mysql_error());
      $totalRows=mysql_num_rows($Result1);
      if ($totalRows==0):
          {$strSql=sprintf("insert into nominateassettb select * from assettb WHERE Asset_ID=%s",
                           GetSQLValueString($HTTP_GET_VARS['AssetID'], "text"));
           mysql_select_db($database_localhost, $localhost);
           $Result1 = mysql_query($strSql, $localhost) or die(mysql_error());
       $msg="编号为".$HTTP_GET_VARS['AssetID']."的资产推荐成功!!";
       header("Location:msg.php?msg=$msg");}
       else:
          { $msg="编号为".$HTTP_GET_VARS['AssetID']."的资产已经被推荐过!!";
    第70行: header("Location:msg.php?msg=$msg");
    }
       endif;
    }
    $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
    }$maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
    }
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;if((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form")){
    if ($selectsort=="请选择"):
        $selectsort="";
    else:
    endif;
    if (isset($selectkind)):
    else:
        $selectkind="";
    endif;
    if ($selectprovince=="请选择"):
        $selectprovince="";
    else:
    endif;
    if ($selectstate="请选择"):
        $selectstate="";
    else:
    endif;
    if (($textfloot0=="") && ($textfloot1=="")):
        $str0="Asset_Floot>0";
    elseif((!($textfloot0=="")) and ($textfloot1=="")):
        $str0="Asset_Floot>=trim($textfloot0)";
    elseif(($textfloot0=="") and (!($textfloot1==""))):
        $str0="Asset_Floot<=trim($textfloot1)";
    elseif((!($textfloot0=="")) and (!($textfloot1==""))):
        $str0="Asset_Floot>=trim($textfloot0) and Asset_Floot<=trim($textfloot1)";
    endif;
    if ((($selectYear0=="年") or ($selectMonth0=="月") or ($selectDay0=="日")) And (($selectYear1=="年") or ($selectMonth1=="月") or ($selectDay1=="日"))):
        {$str1="Asset_Floot>0";}
    elseif ((($selectYear0!="年") or ($selectMonth0!="月") or ($selectDay0!="日")) And (($selectYear1=="年") or ($selectMonth1=="月") or ($selectDay1=="日"))):
        {$str1="Asset_Upto>=trim('$selectYear0-$selectMonth0-$selectDay0')";}
    elseif ((($selectYear0=="年") or ($selectMonth0=="月") or ($selectDay0=="日")) And (($selectYear1!="年") or ($selectMonth1!="月") or ($selectDay1!="日"))):
        {$str1="Asset_Upto<=trim('$selectYear1-$selectMonth1-$selectDay1')";}
    elseif ((($selectYear0!="年") or ($selectMonth0!="月") or ($selectDay0!="日")) And (($selectYear1!="年") or ($selectMonth1!="月") or ($selectDay1!="日"))):
        {$str1="Asset_Upto>=trim('$selectYear0-$selectMonth0-$selectDay0') and Asset_Upto<=trim('$selectYear1-$selectMonth1-$selectDay1')";}
    endif;}mysql_select_db($database_localhost, $localhost);
    if((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form")): 
     {$query_Recordset1 = "SELECT * FROM assettb Where Asset_ID like trim('%$textnumber%') and Asset_Name like trim('%$textname%') and Asset_Sort like trim('%$selectsort%') and Asset_Kind like trim('%$selectkind%') and Asset_State like trim('%$selectstate%') and Asset_Province like trim('%$selectprovince%') and $str0 and $str1 and Asset_Bank like trim('%$textbank%')  order by RIGHT(Asset_ID,8)";}
    else:
     {$query_Recordset1="SELECT * FROM assettb";}
    endif;
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $localhost) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    }
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$queryString_Recordset1 = "";
    if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_Recordset1") == false && 
            stristr($param, "totalRows_Recordset1") == false) {
          array_push($newParams, $param);
        }
      }
      if (count($newParams) != 0) {
        $queryString_Recordset1 = "&" . implode("&", $newParams);
      }
    }
    $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
    ?>
    以上是包括13到70行的代码点击推荐的那一行:
    点击推荐的那一行:
     <td ><a href="assetsearch.php?AssetID=<?php echo $row_Recordset1['Asset_ID'];?>">推荐</a></td>请高手帮我看看