IT.COM

What's this error about

Spaceship Spaceship
Watch
Impact
0
I have got this error and I dont have a glue what its about could any one shade any light on this.

------------
Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/paulicon.co.uk/httpdocs/functions.php:66) in /usr/local/psa/home/vhosts/paulicon.co.uk/httpdocs/delete.php on line 22
-------------

Thanx in advance.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
I am not sure but does your page have 2 headers or something?
 
0
•••
It basically means that your script has already sent some Headers to the browser meaning something like white space, or html or some other headers, and then attempting to do it again, but it can't because the headers have already been sent or something like that. :D

Some possible things that could cause it is white space before your opening delimiter and all the possiblilites with what was mentioned above :)

Example, these wouldn't work:

PHP:
<html>
<body>
<?
header("Location: http://www.webdevtalk.com");
?>

                           <? 
header("Location: http://webdesigntalk.net");
?>
But this would:
PHP:
<?
header("Location: http://www.webdevtalk.com");
?>
 
0
•••
im a n00b to php.. when exactly would you use this header thing?

isnt it the same as include?

nick
 
0
•••
Originally posted by crEA-tEch
im a n00b to php.. when exactly would you use this header thing?

isnt it the same as include?

nick

Well, the header thing is for the header lol.... What I would do is open the PHP file with a text editor like notepad and search with your eyes or the notepad for header( and see if it appears twice.
 
0
•••
Originally posted by crEA-tEch
im a n00b to php.. when exactly would you use this header thing?

isnt it the same as include?

nick

quite good if your using a log system it sends them straight to the page then instead of seting up a redirect script :)
 
0
•••
Thanx i have sloved the problem. It was to do with where I was calling the php file fiunctions.php into the script e.g requre("functions.php"). It dident have anything to do with header being called twice cause it wasent. Strange!!
 
0
•••
Originally posted by web guru
Thanx i have sloved the problem. It was to do with where I was calling the php file fiunctions.php into the script e.g requre("functions.php"). It dident have anything to do with header being called twice cause it wasent. Strange!!

It may have been the same problem with a different scenario. The examples above using the header function were only used as examples because it sends a header. You don't have to have the actual header function in your code in order for your script to attempt to send the headers twice. It's most likely the actual problem was exactly what the error said.

What did you do to fix it? Maybe move the require up before any other code or white space or something else?
 
0
•••
I moved the required field into an if else statement,

------------
if{
header("Location......
}
else{
required("functions.php");
}
------------

This is a scaled down version of the code. It was strange because I run php4 on my test server and it worked fine, but when I uploaded to my online server which runs php3 it through up the error.

Ah well the joys of programming :rolleyes:
 
0
•••
Originally posted by web guru
I moved the required field into an if else statement,

------------
if{
header("Location......
}
else{
required("functions.php");
}
------------

This is a scaled down version of the code. It was strange because I run php4 on my test server and it worked fine, but when I uploaded to my online server which runs php3 it through up the error.

Ah well the joys of programming :rolleyes:

Yes, see that was exactly your problem. :D ;) And yea, I have had that same error occur many times with php scripts. :beer: :webdev:
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back