Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home3/store/includes/connection.php:39) in /home3/store/includes/connection.php on line 30
Could I use the function ob_start(); before session star() and use it anywhere I want? or do I have to star it before any out any ways?
I once used ob _start() function before a header() and it worked. It started the hearder even though there were other outputs before the header() function.
I would recommend not to use buffering (ob_start()) at first hand. Better to start session before any html header outputs. But if you are really compelled to use that then you can use buffering ob_start().
Warning: Cannot modify header information - headers already sent by (output started at /home3/store/includes/header3.php:2) in /home3/store/includes/header3.php on line 12
What is causing the warning is the setcookie() function which is mention in the tutorial that satya has recommended in the previous post along with hearder();. Now since setcookie() is inside a if and else statement I don’t see how can I put it on the top as session star(); is. If I put it in the top then the else statement won’t have any effect on the setcookie() function. Is that a good place to use ob_star();?
Even though you may not think of them this way, because visually you can’t see them, a “new line” is actually one, or sometimes two, characters. Characters are “output”. The php error message gives you a hint at which line number you sent output on. Characters outside of php tags are automatically output.