Re: Sessions: what's wrong sith this code?

From: Date: Thu, 29 Mar 2001 06:44:15 +0000
Subject: Re: Sessions: what's wrong sith this code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46017@lists.php.net to get a copy of this message
Why do you use un/serialize() for array? If you are using PHP4 session, you don't need it. It's done in session module. Multiple serialize() may be causing your problem. -- Yasuo Ohgaki "Christian Dechery" <lemming@vento.com.br> wrote in message news:5.0.0.25.2.20010328220050.022c9110@pop-gw.vento.com.br... > I tried to put an array into a session, but I can get it to work... here is > my code: > > <pre> > if(!isset($script_total_time)) > { > $script_total_time=(float)$total_time; > session_register("script_total_time"); > $step_times_array[$step]=$total_time; > $step_times=serialize($step_times_array); > //echo "step_times=\"$step_times\""; > //this when not commented, echoes perfectly the string with the > serialized array... > session_register("step_times"); > //so why doesn't it work if $step_times is in fact a string? > } > else > { > $script_total_time+=(float)$total_time; > $step_times_array=unserialize($step_times); > $step_times_array[$step]=$total_time; > $step_times=serialize($step_times_array); > } > </pre> > > the variable $script_total_time works like a charm, and it also updates > perfectly, but the step_times array simply doesn't work... I looked into > the session-cookie-file and the step_times is set but as empty... I don't > get what is wrong... For the record this is a code from a script which have > several steps, all reloads of the same .php file and I want to store the > execution times for each step (step_times) and the total running time > (already working)... > ____________________________ > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#46017) next »