RE: Variables de SESSION dentro de funciones PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, I'll try it now.

-----Original Message-----
From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com] 
Sent: Friday, December 13, 2002 1:49 PM
To: Francisco José Saiz :: netPerceptions
Subject: Re:  Variables de SESSION dentro de funciones PHP


You're mixing register_globals off session code with register_globals on

session code.  $HTTP_SESSION_VARS['myvar'] doesn't get defined until the

second page view after setting it.  Try:

session_start();

function OneFunction()
{
	$GLOBALS['HTTP_SESSION_VARS']['myvar'] = 'ABC';
}
onefunction();
echo($HTTP_SESSION_VARS["myvar"]);



Francisco José Saiz :: netPerceptions wrote:

>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:  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:  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.
>
>
>
>  
>

-- 
The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux