Page 1 of 1

headers already sent error message

Posted: Fri Dec 06, 2002 2:11 pm
by fariquzeli
I get this error message:
Warning: Cannot add header information - headers already sent by (output started at /home/ttoomey/youngdental.com/siteadmin/insert.php:2) in /home/ttoomey/youngdental.com/siteadmin/insert.php on line 47
I am fairly sure I can figure out is wrong I just need to know what this error message means exactly. Here's the code around line 47, and I see nothing wrong with it:

Code: Select all

<?php require_once('../Connections/cConnect.php'); ?> 
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
&#123;
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) &#123;
    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;
  &#125;
  return $theValue;
&#125;

$editFormAction = $HTTP_SERVER_VARS&#1111;'PHP_SELF'];
if (isset($HTTP_SERVER_VARS&#1111;'QUERY_STRING'])) &#123;
  $editFormAction .= "?" . $HTTP_SERVER_VARS&#1111;'QUERY_STRING'];
&#125;

if ((isset($HTTP_POST_VARS&#1111;"MM_insert"])) && ($HTTP_POST_VARS&#1111;"MM_insert"] == "form1")) &#123;
  $insertSQL = sprintf("INSERT INTO page (pname, pcontent, ptitle) VALUES (%s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS&#1111;'pname'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'pcontent'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'ptitle'], "text"));

  mysql_select_db($database_cConnect, $cConnect);
  $Result1 = mysql_query($insertSQL, $cConnect) or die(mysql_error());

  $insertGoTo = "http://www.youngdental.com/siteadmin/admin.php";
  if (isset($HTTP_SERVER_VARS&#1111;'QUERY_STRING'])) &#123;
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS&#1111;'QUERY_STRING'];
  &#125;
  header(sprintf("Location: %s", $insertGoTo));
&#125;
?>
the second to last line is the line 47. with the header() function. I can't figure out what is wrong, if you can help I'd greatly appreciate it!

Posted: Fri Dec 06, 2002 2:48 pm
by volka

Posted: Fri Dec 06, 2002 2:55 pm
by fariquzeli
my mistake

i haven't dropped by here in awhile and i just slipped by it i suppose

thanks!