Re: SESSION variables: How much is too much?

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

 



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

Again, it depends upon whether you "need" those variables in the next
page for example.  Think of a wizard, where you fill some values in a
form, click next, fill more values, click next, etc and then click
finish.  You may want to pass the values from each page to the next via
the session and ultimately have them all available in the last page.
There are others ways to do this, such as adding them as hidden inputs
in the next pages, but I personally would use sessions.

One other example might be user info, id, username, firstname, lastname,
current access role etc.  You may use these on every page, so once you
retrieve them from the db, you can store them in the session.  Any other
info like email, age, register date whatever, you can retrieve only when
needed.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
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