Hi everyone,
I have an index.php page with session variables being propagated through a MySQL database (same method as one of the columns on phpbuilder used http://www.phpbuilder.com/columns/ying20000602.php3 ).
If I do something like this in the index.php file it works great. I call start_session() in inc/header.php.
require("inc/header.php");
.
.
session_register("MyVar");
.
.
and the variable is registered fine. But when I do something like this:
require("inc/header.php");
require("inc/myfile.php");
.
session_register("MyVar");
.
my_function(10);
.
and my_function() function is defined in "myfile.php" like this:
function my_function($var) {
session_register("var");
}
it doesn't register the value for var with the session. I get the var variable in the database like this:
MyVar|i:33;!var|
and var is never stored. If I do an isset($var) after the call the my_function it returns false. Why doesn't this work? I need to keep the two files seperate for design reasons. Also, I had planned on using this technique quite a bit, is this a bad way to register session variables? Can anyone shed some light on this? The basic question is - how can I register a session variable that is in an included file?
Thanks,
Jeremy