Eritrea Posted September 30, 2012 Share Posted September 30, 2012 else if(mysql_num_rows($result)==1) // <-- If ONE row is returned { $my_session = mysql_result ($result, 0, 'u_id'); // <-- then user is Authentic & Start session $_SESSION['clans'] = $my_session; header('location:../FINAL/index.php'); } As you can see the above, it is a script for a log-in page, basically saying that if row is returned from my MySQL then take user to index page. Unfortunately, I am having a header already sent error. For two days, I have tried to figure out this problem but no hope. Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted September 30, 2012 Share Posted September 30, 2012 Are you outputting any HTML/text before the header request is sent? Quote Link to comment Share on other sites More sharing options...
Eritrea Posted September 30, 2012 Author Share Posted September 30, 2012 The above code you see is a log-in file. It is all php inside. But in another file called login.php I have included it and other file called login_form.html which is all html Quote Link to comment Share on other sites More sharing options...
Christian F. Posted September 30, 2012 Share Posted September 30, 2012 The thread "HEADER ERRORS" explains this issue, and how to solve it, in detail. I recommend reading through it. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 30, 2012 Share Posted September 30, 2012 I recommend reading the error message you are getting, because it tells you where your page is sending output to the browser that is preventing the header from working. It's that output that you must find and eliminate or you must reorder the code on your page so that the logic using the header() statement comes before sending any non-header output to the browser. Quote Link to comment Share on other sites More sharing options...
Eritrea Posted October 1, 2012 Author Share Posted October 1, 2012 This is the structure of the file. <?php include database file ?> <link style shit or css here > <?php php file inside there are login queries and login checkers or the script above mentioned ?> <?php include an html file containing the html form only for login site users ?> <div simple html for footer of the site. ? Now the problem is happening at the line three, with is called login.php and contains nothing except - check if user is log-in and die - if user is not logged in, then autheniticate his/her input with database - If user exits then, perform: - header("location: loged-in.php") I keep asking about this problem, and always the same answers. I can't understand it. This thing is driving me crazy. I've never struggle to know about PHP as much as I am doing about header errors. Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 1, 2012 Share Posted October 1, 2012 Your style and css "stuff" should be included AFTER php processing. Quote Link to comment Share on other sites More sharing options...
Eritrea Posted October 1, 2012 Author Share Posted October 1, 2012 I tried that. But the css does not work. The site got defaced. Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 1, 2012 Share Posted October 1, 2012 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.