What are these weird variables??
| From: | Brian Dunning | Date: | Fri, 03 Jun 2005 14:38:47 +0000 |
| Subject: | What are these weird variables?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-216316@lists.php.net to get a copy of this message | ||
I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this:
if(!defined("MAGPIE_DBUSER")) define("MAGPIE_DBUSER", "brian");
...
$dbuser = MAGPIE_DBUSER;
...
$dbh = mysql_connect($dbhost,$dbuser,$dbpass);
And it works fine. But I already have my database parameters configured in some existing variables, so I tried to simplify all of the above and access it like this (these variables are my existing ones):
$dbh = mysql_connect($db_host,$db_user,$db_pass);
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?