simple, but missing something?
| From: | Jas | Date: | Fri, 26 Mar 2004 21:43:33 +0000 |
| Subject: | simple, but missing something? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181585@lists.php.net to get a copy of this message | ||
Not sure why I am not able to get this to work, but to make my stuff easier to configure for different environments I am trying to re-code some of my stuff to work with options from an array.
$cfg['hostname'] = "www.server.com"; // Server domain or ip address
$cfg['username'] = "username"; // Database user name $cfg['password'] = "password"; // Database password$cfg['bugemail'] = "admin@server.com"; The do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } Is there something special I have to do to get variables out of an array for use here? I have used $user = "name"; and called stuff like @mysql_connect($name); and it has worked before, I think I am missing something here. TIA Jas