Re: Missing session vars when doing var_dump()

From: Date: Thu, 20 Mar 2003 23:34:33 +0000
Subject: Re: Missing session vars when doing var_dump()
Groups: php.general 
Request: Send a blank email to php-general+get-140509@lists.php.net to get a copy of this message
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:anup_patel@rogers.com] > Sent: Friday, March 21, 2003 11:29 AM > To: php-general@lists.php.net > 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" <GavinJ@trutest.co.nz> wrote in message > news:26c45d2aa5f992d11d49af97221c57533e7a4af2@trutest.co.nz... > > 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

« previous php.general (#140509) next »