Use $GLOBALS['var1']

That will get the variable from the correct scope.
-- 
Scott Carr
OpenOffice.org
Whiteboard-Doc Maintainer
http://whiteboard.openoffice.org/doc/


Quoting Matt Babineau <[EMAIL PROTECTED]>:

> Ok, I just read a section in a book about functions. In my cost I have
> some variables set:
>  
> $var1 = "1";
>  
> And I have a function I wrote that needs to utilize that variable.
>  
> function runvar()    {
>     query database looking for $var1;
>     }
>  
> I get horrible errors though. In the book it talked about the local
> fuciton scope not being able to communicate with the global scope. How
> can I pass $var1 into the function so it can be used?
>  
> Matt Babineau
> Freelance Internet Developer
> -----------------------------------------
> e:  <mailto:[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.illuminatistudios.com/> http://www.illuminatistudios.com
>  
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

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

Reply via email to