jarednz Posted December 23, 2006 Share Posted December 23, 2006 file = main_api.php[code] $database = "blah";[/code][code]function dbConnect() { global $database, $hostname, $username, $password, $db; $db = mysql_connect($hostname, $username, $password) or die ("Error connecting to database."); mysql_select_db($database, $db) or die ("Couldn't select the database."); return $db; }[/code]returns..[code]Undefined variable: database in d:\inetpub\www\core\main_api.php on line 48Couldn't select the database.[/code]what am I missing here? I've specified my global variables but it still complains? Link to comment https://forums.phpfreaks.com/topic/31649-solved-global-scope-help/ Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 Check your spelling. Link to comment https://forums.phpfreaks.com/topic/31649-solved-global-scope-help/#findComment-146689 Share on other sites More sharing options...
jarednz Posted December 23, 2006 Author Share Posted December 23, 2006 bah sorted.Not a spelling problem though. ??? Link to comment https://forums.phpfreaks.com/topic/31649-solved-global-scope-help/#findComment-146696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.