Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\samples\htmls\login.php:7) in C:\xampp\htdocs\samples\htmls\login.php on line 39

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\samples\htmls\login.php:7) in C:\xampp\htdocs\samples\htmls\login.php on line 39

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\samples\htmls\login.php on line 41
Wrong Username or Password
can anyone tell me what went wrong? thou i cant find any error i think in my code..
:confused:

Recommended Answers

All 4 Replies

Session can not be initiated since HTTP headers have already been sent. The thing is that session sets a cookie which is sent as a header directive. All headers HAVE TO be sent before and only before any content is sent (this is the requirement of the HTTP protocol not PHP).

The reason for this error is in that your script may be sending some content on line 39 (maybe just one space). Have a look there, remove content content or place the session_start() earlier in the script. If it does not help post the code.

Session_start() should be at the top of your file. If that is the case then check this comment, you might read all comments too

If you must start session after sending output (headers), consider ob_start()
This post is also useful

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.