luthar28 Posted December 16, 2010 Share Posted December 16, 2010 Okay, I've read all the rules for Headers...still can't it to execute properly. At the bottom is my code. I basically want to check the database, see if the user is already registered, and redirect as appropriate (there is no HTML on my page, no info sent to the browser). My server doesn't send any error messages. All I get are white screens. Now, if I do the headers_sent()...it tells me that it's sent right after the initial connection with the database. The ONLY way I can get it to redirect, is if I put <?php header("location:index.php?msg=3"); ?> at hte very top, but then I can't evalute...which doesn't help me much. Here is the code (obviously, I have more...but it's sending headers in these lines) <?php $connection = mysql_connect("localhost","####","#####"); if (!$connection){ echo mysql_errno().": ".mysql_error()."<br/>"; exit; } if(!mysql_select_db("prixaurora")){ echo("Database not found<br>"); } Quote Link to comment https://forums.phpfreaks.com/topic/221918-headers-yes-i-know/ Share on other sites More sharing options...
Pikachu2000 Posted December 16, 2010 Share Posted December 16, 2010 Paste the script in here, from the beginning through the line that has the header redirect. Quote Link to comment https://forums.phpfreaks.com/topic/221918-headers-yes-i-know/#findComment-1148367 Share on other sites More sharing options...
jcbones Posted December 17, 2010 Share Posted December 17, 2010 <?php //<-Make sure there is no whitespace before the opening tag, or (HEADERS ALREADY SENT ERROR); $connection = mysql_connect("localhost","####","#####"); if (!$connection){ echo mysql_errno().": ".mysql_error()."<br/>"; //<-if the connection fails. OUTPUT SENT (HEADERS ALREADY SENT ERROR). exit; } if(!mysql_select_db("prixaurora")){ echo("Database not found<br>"); //<-If the connection fails. OUTPUT sent (HEADERS ALREADY SENT ERROR); } Quote Link to comment https://forums.phpfreaks.com/topic/221918-headers-yes-i-know/#findComment-1148455 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.