RE: [PHP] simple, but missing something?

From: Date: Fri, 26 Mar 2004 21:50:09 +0000
Subject: RE: [PHP] simple, but missing something?
Groups: php.general 
Request: Send a blank email to php-general+get-181587@lists.php.net to get a copy of this message
[snip] $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]); } [/snip] Why are you not using the single quoted array names? i.e. @mysql_connect($cfg['hostname'],$cfg['username'],$cfg['password']); Have you echo'd each out afterwords to see if they are right? Use mysql_error() to return connection errors so that you know what they are.

« previous php.general (#181587) next »