RE: [PHP] What are these weird variables??
| From: | Jay Blanchard | Date: | Fri, 03 Jun 2005 14:46:09 +0000 |
| Subject: | RE: [PHP] What are these weird variables?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-216317@lists.php.net to get a copy of this message | ||
[snip]
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?
[/snip]
http://www.php.net/constants