Re: PHP session variables

From: Date: Thu, 16 Aug 2012 21:37:27 +0000
Subject: Re: PHP session variables
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-318726@lists.php.net to get a copy of this message
On Aug 15, 2012, at 4:42 PM, Andrew Ballard <aballard@gmail.com> wrote: > On Wed, Aug 15, 2012 at 3:24 PM, Tedd Sperling <tedd@sperling.com> wrote: >> The php manual ( >> http://us3.php.net/manual/en/function.session-start.php ) >> >> First Note states that session_start() must be called *before* anything sent to the >> Browser. >> >> So, to rewrite your code -- >> >> for($i=1; $i < 1000; $i++) >> { >> if (!defined('SID')) >> { >> session_start(); >> echo __LINE__, '::session_start()<br>'; >> } >> } >> >> -- should work better, right? >> >> Cheers, >> >> tedd > > > -snip- > However, due to the nature of your test page you are still > sending output from the first loop before you call session_start() in > the second loop. Duh! Too many brain surgeons working on this brain! In the real world neither of us would have made those mistakes. It is only when we try to make things simple do we over complicate. Cheers, tedd _____________________ tedd@sperling.com http://sperling.com

« previous php.general (#318726) next »