At 7:30 PM -0400 7/8/09, D.M.Jackson wrote:
Thanks guys. I was just wondering if it was common practice to pass all
those variables in the SESSION object or if I was following a bad example
because it was the first time that I had seen so many variables passed this
way. If this is the typical way of handling this in php then I don't have a
problem with it, I just wanted to make sure that I wasn't getting off to a
bad start and picking up bad habits while learning php.
Thanks,
Mark
Mark:
As a personal choice, I try to reduce the number of variables I carry
in sessions as much as possible. To me sessions are similar to
Globals and Globals create an environment that is generally not
conducive to writing self-contained and reusable code.
Typically when I'm dealing with many variables, the variables are
usually contained in a database. If this is the case, then I only
pass the id of the record in a session and allow the page to open the
database to retrieve the variables it needs. I have found that the
more session variables you pass, the more complicated the code.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php