If you it's either ALL or Nothing then I would think it has something to do
with retrieving sessions from the client (in the form of the cookie) or on
the server (in the form of the session file, default is /tmp on *nix
systems).  I ran your script on my server where I have session varaibles and
I never had a problem.

I'm out of ideas now.



"Gavin Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Bobby
>
> The following is a copy and paste of the page I'm using to
> generate the problem. I have 18 keys in the $_SESSION
> variable and just by simply refreshing the page with the
> following code, it returns either array(0){} or session info and
> array(18){ will all the correct variables }. I must be doing
> something fundamentally wrong somewhere.
>
> Thanks very much for your willingness to help me.
>
> <?php
>     session_start();
> ?>
> <html>
> <head>
> </head>
> <body>
> <?php
>
> foreach( $_SESSION as $key => $value )
> {
>     echo "<font color=\"FF9900\">SESSION[$key] = $value<br>";
> }
> echo "<br><br>";
> var_dump( $_SESSION );
> ?>
> </body>
> </html>
>
>
>
>
>
> Gavin Jackson, R&D Software Engineer, Tru-Test Ltd.
> Phone: +64-9-9788757,  Fax: +64-9-9788889, <[EMAIL PROTECTED]>
> Tru-Test Ltd, P.O. Box 51-078, Pakuranga, Auckland, New Zealand
>
> > -----Original Message-----
> > From: Bobby Patel [SMTP:[EMAIL PROTECTED]
> > Sent: Friday, March 21, 2003 3:28 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Re: Missing session vars when doing var_dump()
> >
> > Are the queries the exact same every time you refresh them? This seems
> > just
> > to be programming logic (I guess). Post some code and maybe someone (or
I)
> > will be able to help you out.
> >
> > "Gavin Jackson" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Thanks for your input Bobby
> > >
> > > I was using mysql_fetch_array() but changed to mysql_fetch_assoc()
> > > The funny thing is, I have a page that does the var_dump() and all
> > > I'm doing is refreshing the page and sometimes I get 18 other times
> > > 16 variables
> > >
> > >
> > > Gavin
> > > Auckland, New Zealand
> > >
> > > > -----Original Message-----
> > > > From: Bobby Patel [SMTP:[EMAIL PROTECTED]
> > > > Sent: Friday, March 21, 2003 11:29 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP] Re: Missing session vars when doing var_dump()
> > > >
> > > > I would think that they are 16 key/value pairs when the MySQL (TEXT)
> > > > fields
> > > > are null thus the session variables are NOT set thus NOT present.
> > > >
> > > > Hypothsis: I believe that your are using
> > > > mysql_fetch_array($query_resource),
> > > > try using the second parameter as well ie.
> > > > mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
> > > > mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net
> > for
> > > > details of "mysql_fetch_array").
> > > >
> > > > By using the second parameter, even NULL values will has a variable
> > set.
> > > >
> > > > Example say you had a field called FirstName in the MySQL database.
If
> > it
> > > > was NULL, then without the additional parameter you would have NO
key
> > > > named
> > > > 'FirstName' exisiting (ie it is not set). But if you used the second
> > > > parameter a key would be created with no value (ie it is set but
> > empty).
> > > >
> > > > So remember, the second parameter is OPTIONAL, but it has different
> > > > behaviors when you do (and do not) use it. Hopefully I cleared it up
> > (or
> > > > at
> > > > least shed  some light).
> > > >
> > > > checkout :
http://www.php.net/manual/en/function.mysql-fetch-array.php
> > > >
> > > >
> > > > "Gavin Jackson" <[EMAIL PROTECTED]> wrote in message
> > > > news:[EMAIL PROTECTED]
> > > > > Hi
> > > > >
> > > > > I have come across a strange problem. I have an application that a
> > user
> > > > > logs into and when I find the user in the database I load all the
> > custom
> > > > > info for that use which I store. By the time I'm done, the session
> > array
> > > > > has 18 key's. When I do a var_dump($_SESSION) I sometimes get
> > > > > 18 variables and sometimes I only get 16. The two fields that are
> > > > missing
> > > > > are TEXT fields from a MySQL database and they also appear to be
> > > > > the last two keys when var_dump() returns all 18 keys.
> > > > >
> > > > > Does anyone know what is causing this, it's driving me crazy at
the
> > > > > moment with many late nights. The PHP version running is 4.2.3
> > > > >
> > > > > Regards
> > > > >
> > > > > Gavin
> > > > >
> > > > > Auckland, New Zealand
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to