Session variables and include files
Posted: Thu Jun 20, 2002 11:55 am
I'm having a bit of a problem, and would greatly appreciate any help offered.
I have a php based architecture that utilizes session variables and a single include file. I have a session_start at the top of every one of my pages, and the include file defined a few variables I used on each page (DB Connection information)...so I also have a 'include "";' line on each page, as well.
The problem comes in when I try to include another file. This is a file that merely holds functions (I'm cleaning up the other pages and placing redundant functions into this new include file). Some of the functions rely on values retrieved from the already existing session variables. However, for some reason, these can't retrieve the values from the session variables.
My page header is laid out as follows:
session_start();
include('constants.inc');
include('functions.inc');
This layout doesn't work, and neither does placing the functions into the constants.inc file after the variables have been defined. I can't retrieve session variables defined by other pages, either.
I have tried modifying the functions.inc file with a similar header as defined above...no dice.
In summary, I can't retrieve session variables with the functions in the functions.inc file.
Any ideas on what's going on?
Thank you.
I have a php based architecture that utilizes session variables and a single include file. I have a session_start at the top of every one of my pages, and the include file defined a few variables I used on each page (DB Connection information)...so I also have a 'include "";' line on each page, as well.
The problem comes in when I try to include another file. This is a file that merely holds functions (I'm cleaning up the other pages and placing redundant functions into this new include file). Some of the functions rely on values retrieved from the already existing session variables. However, for some reason, these can't retrieve the values from the session variables.
My page header is laid out as follows:
session_start();
include('constants.inc');
include('functions.inc');
This layout doesn't work, and neither does placing the functions into the constants.inc file after the variables have been defined. I can't retrieve session variables defined by other pages, either.
I have tried modifying the functions.inc file with a similar header as defined above...no dice.
In summary, I can't retrieve session variables with the functions in the functions.inc file.
Any ideas on what's going on?
Thank you.