Hello,..i have a file called publLoaderDetail.php which included to nextPage.php....and when i run the script this error message is appear: Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\greenPlaza full version ii\nextpage.php:16) in c:\apache\htdocs\greenPlaza full version ii\cont\publLoaderDetail.php on line 4 i think it a session problem, and these are the session script of those file: nextpage.php: <?PHP session_start(); include "greenPlazaConfig/config.php"; $connection=mysql_connect($host,$user,$pass) or die(mysql_error()); mysql_select_db($db,$connection); ?> and publLoaderDetail.php: <?PHP if (!isset($_SESSION["username"]) || !isset($_SESSION["password"])) { header ("location:../homepage.php"); } else { $username=$_SESSION["username"]; $password=$_SESSION["password"]; if(!$username || !$password) { header ("location:../index.php"); } else { include "conPlazConfig/config.php"; $connection=mysql_connect($host,$user,$pass) or die(mysql_error()); mysql_select_db($db,$connection); $loginQuery=mysql_query("select * from apprMemberReg where userCp='$username' and activePwd='$password'",$connection) or die (mysql_error()); $loginRow=mysql_num_rows($loginQuery); $rowLogin=mysql_fetch_array($loginQuery); if($loginRow=="0") { $_SESSION=array(); session_destroy(); header ("location:../index.php"); } } } My question is, : 1. What is the meaning with that error message? 2. What is the problem with my script?... Thank you very very very much
The message means that you are outputing text somewhere prior to the header command. You cannot output any text at all--not even a single space--prior to creating a header.
Exactly, or enable buffering in your php.ini. As far as exiting after header redirects, not needed. It redirects and will not get far enough to exit. Unless you are buffering the data, all headers must come before the html output. Even a space before the header can do it. Buffer and you will be fine.
White space could be before the <?php or after the ?> also, you could be calling session_start after you have outputed to the screen. Most of the time it is white space that happens sometimes with ftp uploading of files. It says it is coming from nextpage.php, but since that is not 16 lines long. I would look into the config.php file for the output error.