note 26372 added to function.session-start

From: Date: Mon, 28 Oct 2002 21:51:42 +0000
Subject: note 26372 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-38666@lists.php.net to get a copy of this message
I would just like to say: If you are using an include page, such as a config or possibly common-functions page, that relies on session variables being pulled from the sesssion, remember to add the session_start() function _before_ you call the includes, or your session will not be called by the page... I've been frustrated by this so many times it's not funny. Use: <?php session_start(); include 'inc/config.inc.php'; include 'inc/common.inc.php'; /* Page code */ ?> Not: <?php include 'inc/config.inc.php'; include 'inc/common.inc.php'; session_start(); /* Page code */ ?> This is important because including a file is _exactly_ like pasting it into the page, just cleaner. If you don't call the session _first_, the config code won't recognize it and you will waste a lot of time and be really annoyed. Luck Everyone! ~ Shadowflame http://www.starpilot.net -- http://www.php.net/manual/en/function.session-start.php http://master.php.net/manage/user-notes.php?action=edit+26372 http://master.php.net/manage/user-notes.php?action=delete+26372 http://master.php.net/manage/user-notes.php?action=reject+26372

« previous php.notes (#38666) next »