On Wed, April 19, 2006 1:36 am, Chris Grigor wrote: > Richard Lynch wrote: > >>On Tue, April 18, 2006 10:05 am, Chris Grigor wrote: >>>Was wondering if there is an easier way to get returned variables >>> into >>>the $_SESSION rather than going through each one?? >>foreach($line as $key => $value) $_SESSION[$key] = $value; >> Why do this? >> Is it really going to help you to have the data stored in TWO >> places? >>I predict that if you really think about what you are doing, you >> won't >>want to do this. There are simply too many pitfalls for this to be a > The point of me doing this is that I will be pulling menu flags from a > database on a user level. > in the db I will have menu items 1 to 20 turned on or off. When a user > logs in these flags are pulled > and depending if they are truned on or off, the menu will display. > Catch my drift?? Tell us the part about where having them copied into $_SESSION makes your software better... :-) Database -> Menu is a very simple and common web design. Database -> $_SESSION -> Menu only adds an extra step, AFAICT. Are you able to completely avoid connecting to the database on many subsequent pages this way? That could be Good Code. Or are you just avoiding a single simple query that, with indexed fields, should run in a splintered second? That's probably Bad Code. $_SESSION data is not free. It's not even cheaper than MySQL data, as a general rule -- though it might be in specific cases. Simplify, grasshopper. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php