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?

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

Reply via email to