accessing session variables in functions
| From: | D Robinson | Date: | Fri, 20 Oct 2000 20:04:39 +0000 |
| Subject: | accessing session variables in functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21469@lists.php.net to get a copy of this message | ||
Since no-one answered my last email (no hard feelings:)), just maybe,
someone could help me with this:
Niether:
function go()
{
session_start();
session_register("count");
$HTTP_SESSION_VARS["count"]++;
print "visited " . $HTTP_SESSION_VARS["count"] . " times";
}
NOR:
function go()
{
global $count;
session_start();
session_register("count");
$count++;
print "visited " . $count . " times";
}
will make the $count rise when reaccessing the page, but they both work fine
when when not in a function
Regards
Dale Robinson