RE: [PHP] GLOBAL VARIABLES
| From: | Grant Walters | Date: | Sun, 15 Oct 2000 01:34:37 +0000 |
| Subject: | RE: [PHP] GLOBAL VARIABLES | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20184@lists.php.net to get a copy of this message | ||
> eg;
> $resu;
> function a()
> { global $resu;
> $resu=exec statment;
> }
> function b()
> {
> gloabal $resu;
> odbc_result($resu,"name");
> odbc_result($GLOBALS["$resu"],"name");
> }
> i try to echo $resu in function b there is nothing
> what should i do?
How about passing the variable to each function, as in:
$resu=""
function a($resu="") {
....
}
function b($resu="") {
....
}
a(&$resu);
b(&$resu);
Regards
Grant Walters
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265