Re: What are these weird variables??

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

 



On 6/3/05, Brian Dunning <brian@xxxxxxxxxxxxxxxx> wrote:
> I'm using a class that I downloaded, and to access the database it
> uses variable names in all caps, like this:

those are constants: it's like a variable, except once you define it,
it stays set at that value and you can't change it.


> And it no longer works, says it can't connect to the database. What's
> the deal with those variables in all caps, and why won't mine work?
> The above class is inside a defined function, are my variables not
> valid inside that function?

well, if you have variables in the body of your script, and you want
to use those same variables, you should declare them global in your
function.

http://us3.php.net/variables.scope

hope that helps
drew

-- 
dc .. drewcore.com

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux