Does this variable change? If not I would use a constant.
Rather than declaring it on every page, you could EG:
Create a file called globalConstants.inc, this file would hold your constant(s). Then place an include on every page to this file.
An example of how I use this file:
I create constants for UserName, Password, DBName and machineName. These constants are used in my globalFunctions file in my SQLServer connection string, this globalFunction file is also an include on every page that needs a database connection.
;;;I wonder the plus and minus of using session variables
Use these sparingly. What I use them for:
A variable that has the ability to change, needs to be carried from page to page and it's not practical to use hidden form variables (num 1 choice) or query strings (number 2 choice)
;;;and a "global" variable
A session variable is a global variable, (different in PHP)
Wind is your friend
Matt
|