this allways buggers people up

    session_register("count");
    $count = array();

should be

    $count = array();
    session_register("count");

you have to set the var first before registering it. you should also check
if the var is allready registerd ($HTTP_SESSION_VARS[]) if so, dont
re-register it, this can cause session to segfault apache every so often.

www.mediawaveonline.com/exmaples/session.txt

this is my session file I use, take a look at what I mean.

also your using php4 so try foreach() its alot nicer, just looks better.

foreach($count as $key => $value)
vs
while (list($key, $value) = each ($count))

--

  Chris Lee
  [EMAIL PROTECTED]




"Christian Haines" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi all,
>
> PHP-4.03pl
> LINUX 7.0
>
> i am still having problems with sessions. the following does nothing but
> should appear to do something! it is just a simple experiment to test that
> sessions work. session_test.php calls session_proc.php to perform one of
> three functions.
>
> i would really appreciate any help as this is driving me nuts. i have also
> tested this on other systems to no avail.
>
> many thanks in advance,
> christian
>
>
> ------------- session_test.php ------------------------------------------
> <html>
>
> <body>
> <?
>         if(is_array($count))
>         {
>             reset ($count);
>             while (list($key, $value) = each ($count)) {
>                 echo "Key: $key; Value: $value
> Count:".count($value)."<br>\n";
>
>                 if(is_array($value))
>                 {
>                     reset ($value);
>                     while (list($key2, $value2) = each ($value)) {
>                     echo "---> Key: $key2; Value: $value2 <br>\n";
>                     }
>                 }
>             }
>         }
>
>         print "<br>&nbsp;<br>".count($count)."
> ---".session_is_registered("count");
>
> ?>
> <form name=test method=post action=session_proc.php>
> <input name=increment type=submit value=increment><input name=reset
> type=submit value=reset><input name=decrement type=submit value=decrement>
> </form>
>
> </body>
> </html>
>
> ------------- session_proc.php ------------------------------------------
> <?
>     session_start();
>
>     session_register("count");
>     $count = array();
>
>     if(isset($increment))
>     {
>         $count[0] = 9;
>         $count[1] = 11;
>         $count[2] = 12;
>     }
>
>     if(isset($reset))
>     {
>         unset($count);
>     }
>
>     if(isset($decrement))
>     {
>         $count[0] = 4;
>         $count[1] = 6;
>         $count[2] = 1;
>     }
>
>     header("location: session_test.php");
>     exit;
> ?>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to