jwwceo Posted January 2, 2008 Share Posted January 2, 2008 I know header errors are usually caused by outputting before the header command....but I don't have any output...no includes....before the header command. I get an error saying headers already sent on line 6. Any ideas??? <?php error_reporting(E_ALL); mysql_connect ('localhost','xxxx', 'xx') or die("my sql error"); mysql_select_db ('lxxxxx'); if(isset($_GET[id])){ $shirtid = $_GET[id]; $sql="Select * from shirts Where shirt_id='$shirtid'"; $res=mysql_query($sql); $rs=mysql_fetch_assoc($res); $link=$rs[link]; $site_id=$rs[site_id]; if ($site_id == 6){ $newlink = "http://www.tshirthell.com/store/clicks.php?partner=jwwceo&page=".$link; } header("Location: $newlink"); } else { header("Location: index.php"); } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 Are you sure there is no whitespace outside your <?php ?> tags? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 please put a exit(); after your header function. it should work then.. Quote Link to comment Share on other sites More sharing options...
jwwceo Posted January 2, 2008 Author Share Posted January 2, 2008 I added the exit tag to look like this: header("Location: $newlink"); exit(); but I get the same error. headers already sent by (output started at /home/liquid/public_html/link.php:6) There is no white-space outside the php tags. Quote Link to comment Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 PHP may be attempting to output error messgaes caused by your code. You might try fixing all the undefined constants. eg; $_GET[id] should be..... $_GET['id'] Quote Link to comment Share on other sites More sharing options...
jitesh Posted January 2, 2008 Share Posted January 2, 2008 Are you connecting to DB properly ? May may be you are getting die with and printed string "my sql error". This is just assumption. Quote Link to comment Share on other sites More sharing options...
jwwceo Posted January 2, 2008 Author Share Posted January 2, 2008 Then problem was the errors trying to be outputted for not using ' ' in the undefined constants. THANK YOU GUYS FOR THE HELP!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.