Hi,
i have a problem with the first variable, which will be saved in the session-file. It seems like this:
<?php
session_register("counter1");
$counter1++;
session_register("counter2");
$counter2++;
echo "<p>$counter1</p>$counter2";
?>
Here will two variable be saved in the session-file, they count the visit-times of the Site. Now i change the code:
<?php
$counter1=888;
session_register("counter1");

$counter2=888;
session_register("counter2");
echo "<p>$counter1</p>$counter2";
?>
After the execution of the script will just the $counter2 in der Session be overwritten, and $counter1 not!

Is here somebody, who can explain me why?

Regards!

Jack

    Hi,
    i've found a way to avoid the mentioned problem: just change the sequence of the two statement:
    as the first should the "session_register($SID)" be written,
    and then the definition of the session variable "$SID= session_id();"

    It's comical !!!

    Jack

      $counter1=888; // This will set counter1

      session_register("counter1"); // This will restart the session using an implied session_start and reload the original value of counter1 over writing the above value.

      $counter2=888; // This will set counter2

      session_register("counter2"); // The session is already started so it will no restart. counter2 remains set at 888.

      As an example, use session_start() at the top of your script.

      --
      Roger

        Write a Reply...