Sessions: what's wrong sith this code?
| From: | Christian Dechery | Date: | Thu, 29 Mar 2001 01:07:52 +0000 |
| Subject: | Sessions: what's wrong sith this code? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45982@lists.php.net to get a copy of this message | ||
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