include(); problem

Reply

Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

include(); problem

 
0
  #1
Jun 9th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: include(); problem

 
0
  #2
Jun 9th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

Re: include(); problem

 
0
  #3
Jun 10th, 2005
Thanks, Troy.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1462 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC