Page 1 of 1

Headers already sent by...

Posted: Sun Jan 26, 2003 4:28 am
by techlinks
Hi:

I'm using a popular MySQL class named "PHPTOOLS4U" for a project I'm working on. Its found at:

http://www.phptools4u.com/scripts/shows ... ript=mysql

Whenever I simply include the class, any code I have that calls the header() function fails with:

Warning: Cannot add header information - headers already sent by (output started at C:\apache\htdocs\lib\mysql_inc.php:197

The strange thing is that I'm not even calling any functions; just including it. If you took a quick peek at the source at:

http://www.phptools4u.com/scripts/shows ... ript=mysql

...is there anything obvious you see that suggests that the mere inclusion of this class causes PHP to think that header information has already been sent? I just can't see it so I'm hoping a another pair of eyes can help. It's a fairly short class library, say about 6 functions only.

Thanks for your help.

Techlinks

Posted: Sun Jan 26, 2003 5:43 am
by volka
double check that there's nothing before <?php and nothing after ?>
Not a linebreak nor a space, nothing

Posted: Sun Jan 26, 2003 11:11 pm
by evilcoder
you can always start your page with:

<?php

ob_start()

?>

and at the end put

<?php

ob_end_flush()

?>

That way you can define your headers anywhere inside the document.