RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
| From: | Francisco José Saiz : : netPerceptions | Date: | Fri, 13 Dec 2002 12:37:41 +0000 |
| Subject: | RE: [PHP-DB] Variables de SESSION dentro de funciones PHP | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24112@lists.php.net to get a copy of this message | ||
Hi,
I have made a PHP function that reads a tablename from a file. I want to
keep the tablename value into a session var. I register the session vars
and assign the value. But when I try to access outside the function the
variable is empty.
I do this:
session_start();
function OneFunction
{
$myvar="ABC";
session_register("myvar");
}
echo($HTTP_SESSION_VARS["myvar"]);
And do not prints nothing.
Why? Is a scope fault?
Thanks.
-----Original Message-----
From: Snijders, Mark [mailto:Mark.Snijders@atosorigin.com]
Sent: Friday, December 13, 2002 1:08 PM
To: '_netPerceptions?='; php-db@lists.php.net
Subject: RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
english please!!!
_______________________________
Mark Snijders, Developer
Atos Origin
Groenewoudeseweg 1, Room VN-515
5621 BA Eindhoven, The Netherlands
* : Mark.Snijders@atosorigin.com
* :+31 (0)40 - 2785992 (tel)
* : +31 (0)40 - 2788729 (fax)
The information in this mail is intended only for use of the individual
or entity to which it is addressed and may contain information that is
privileged, confidential and exempt from disclosure under applicable
law. Access to this mail by anyone else than the addressee is
unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken omitted to be taken in
reliance of it, is prohibited and may be unlawful.
-----Original Message-----
From: _netPerceptions?= [mailto:fjsaiz@net-perceptions.com]
Sent: vrijdag 13 december 2002 12:33
To: php-db@lists.php.net
Subject: [PHP-DB] Variables de SESSION dentro de funciones PHP
Hola,
tengo una función en PHP que me lee de un fichero una configuración de
unas tablas de BBDD, quiero que el nombre de las tablas así como los
datos de conexión, me queden residentes en unas variables de sesión.
Cuando registro las variables dentro de la función, al acceder desde
cualquier otro punto con $HTTP_SESSION_VARS["nombrevariable"] me pone
como que está vacía.
¿alguien podría aclararme el tratamiento de estas variables en PHP?
Saludos y muchas gracias.