Hi,
I have a file with the dbase connection details which I call into my script using: include("config.php");

Problem is that when I need to include a page redirection, namely:
header("Location: other_page.php");

I get an error saying that headers were already sent from the line with the include("config.php");

How do i get around this so I don't have to write out the dbase connections everytime I need to have a
header("Location: other_page.php");
thanks.

Recommended Answers

All 2 Replies

I assume you already checked to make sure config.php does not actually echo or print anything to the buffer!

Look at your closing ?>. Is there a blank line after it? I've seen this cause the problem you describe. Delete anything after the closing tag. Also, if you are using PHP on Linux, make sure your files use Linux style line endings.

Thanks, Troy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.