The problem does not appear to be database related, it appears to header
related.  You are trying to send header information after sending regular
output.  You can't do this:

<?php
echo 'blah blah';
header("Location: ".$out);
?>

BUT you can do this:

<?php
$some_text = my_function();
if ($some_text) echo $some_text;
else header("Location: ".$out);

function my_function() {
  // some code goes here
  if ($something) return $some_text;
  return;
} // end my_function()
?>

Try looking at line 29.  that's the line where you are trying to output a
header after outputing some text.


Henning Sittler
www.inscriber.com



-----Original Message-----
From: Logan McKinley [mailto:[EMAIL PROTECTED]
Sent: Friday, June 20, 2003 10:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Cannot modify header information - headers already sent 


I am having a problem when i use an include file to include database
connectivity, however if i cut and paste the code out of the include and
place it directly into the .php file it works.  I am not sure how to figure
this problem out.
<===================  error:
Warning: Cannot modify header information - headers already sent by (output
started at c:\inetpub\wwwroot\PHP\includes\db_conn.inc:1) in
c:\inetpub\wwwroot\PHP\login_action.php on line 29
<===================  main page
<?
session_start();
include("includes\db_conn.inc");
if(!isset($HTTP_POST_VARS['login']))
 echo "end in if 1";
else if(empty($HTTP_POST_VARS['login']))
 echo "end in if 2";
else
 $login = $HTTP_POST_VARS['login'];

if(!isset($HTTP_POST_VARS['pw']))
 echo "end in if 3";
else if(empty($HTTP_POST_VARS['pw']))
 echo "end in if 4";
else
 $pw = $HTTP_POST_VARS['pw'];

$strSQL = "SELECT * FROM [Login] WHERE [Login] = '".$login."' AND pw =
'".$pw."'";
$rs = $conn->execute($strSQL);
if(!$rs->EOF)
{
 $_SESSION = "TRUE";
 $out = "admin_menu.php";
}
else
 $out = "login.php?err=error";
header("Location: ".$out);
?>
<===================  include
  <?
  $conn = new COM("ADODB.Connection");
  $strConn = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=C:\Inetpub\wwwroot\PHP\data\Registration.mdb";
  $conn->open($strConn);
  ?>
<===================  include
Thanks in advance,
~Logan





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to