Geir Pedersen - Activio AS <mailto:[EMAIL PROTECTED]> on Friday, March 26, 2004 2:05 PM said:
> 1) You have to declare $cfg as a global variable in your > data_connection() function. PHP differs from C with respect to how > you access global variables from within functions. Read about > global variables here > http://www.php.net/manual/en/language.variables.scope.php an alternative to that would be to use constants. define("CFG_HOSTNAME", "www.server.com"); define("CFG_USERNAME", "username"); define("CFG_PASSWORD", "password"); define("CFG_BUGEMAIL", "[EMAIL PROTECTED]"); function database_connection() { @mysql_connect(CFG_HOSTNAME, CFG_USERNAME, CFG_PASSWORD); @mysql_select_database(CFG_DATABASE); } hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php