Re: Session Vars loaded from MSSQL Query drop, those loaded from MYSQL Query stick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 17, 2010 at 8:13 AM, Cheryl Sullivan <csulliva@xxxxxxx> wrote:
> Hi Andrew - I didn't mean to ignore your reply...
>
> Here is your earlier post -
>
> " The fact that you can echo the $_SESSION information on the same page and they contain the correct values suggest to me that the issue of MySQL/MSSQL is a red herring. I would look into things like the value for register_globals to make sure you don't have a global variable stepping on some of your session variables."
>
> Register_globals is off in our php.ini file.
>
> Again, I am fairly new to PHP. I guess I don't understand how a global variable can "step on" a session variable if the only thing I'm assigning anywhere in my application to said session variable is a value from a database query.  When PHP changes pages, it might be arbitrarily assigning some value to a session variable, even though I'm not telling it to?
>
> Can you please explain this to me?  Thanks -
>

It's been a while since I've dealt with either, but I believe the most
common way would involve register_globals (and session auto_start?).
The session would automatically register global variables named $SSN
or $CostCenter in your page that would be tied to $_SESSION['SSN'] and
$_SESSION['CostCenter'], even before a line of code was executed. If
you then change the value of $SSN - even if you intentionally
initialize it to an empty value at the beginning of a script -- PHP
would alter the value of SSN in the session itself.

I don't know exactly what is happening in your case. All I am
suggesting is that if you are getting the correct values from the
database and you can see that they have been correctly assigned to the
$_SESSION array when you echo them later in the script, the issue is
somewhere other than with the database and you need to dig somewhere
else for the solution.

Andrew

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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux