Crew-Portal Posted August 21, 2009 Share Posted August 21, 2009 <?php $config= array('site'=> array('connection'=> array('database'=>'SECRET', 'username'=>'SECRET', 'password'=>'SECRET', 'location'=>'localhost'), array('settings'=> array('backgroundcolor'=>'#CEE1E9', 'contentcolor'=>'#FFFFFF', 'sidebarcolor'=>'#C8D1D5', 'textcolor'=>'#000000', 'linkcolor'=>'#002E6E', 'backgroundimage'=>null, 'disposition'=>1), ), array('name'=> array('sitename'=>'None', 'slogan'=>'None', 'language'=>'English'), ), array('sessions'=> array('username'=>$_SESSION['valid_user'], 'user_id'=>$_SESSION['user_id']), ), ) ) ;?> Why cant I access my arrays like.. $config['site']['settings']['backgroundcolor']; I cant figure it out. And im not getting any errors.. Quote Link to comment Share on other sites More sharing options...
trq Posted August 21, 2009 Share Posted August 21, 2009 Some consistent indentation would likely help you. Quote Link to comment Share on other sites More sharing options...
trq Posted August 21, 2009 Share Posted August 21, 2009 Try print_r($config) to see what you've got. Looks to me like 'settings' is within 'connection'. Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted August 21, 2009 Author Share Posted August 21, 2009 I surrounded the array with <PRE></PRE> and got: Array ( [site] => Array ( [connection] => Array ( [database] => SECRET [username] => SECRET [password] => SECRET [location] => localhost ) [0] => Array ( [settings] => Array ( [backgroundcolor] => #CEE1E9 [contentcolor] => #FFFFFF [sidebarcolor] => #C8D1D5 [textcolor] => #000000 [linkcolor] => #002E6E [backgroundimage] => [disposition] => 1 ) ) [1] => Array ( [name] => Array ( [sitename] => None [slogan] => None [language] => English ) ) [2] => Array ( [sessions] => Array ( [username] => [user_id] => ) ) ) ) Does that shed any light on the situation? Cause I understand that I dont have the arrays grouped properly. But sadly I dont know how to fix it :'( Quote Link to comment Share on other sites More sharing options...
Garethp Posted August 21, 2009 Share Posted August 21, 2009 You forgot to close your connection array Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted August 21, 2009 Author Share Posted August 21, 2009 Thanks, That wasnt the problem but I got it solved myself. How I did it.. I still dont know.. But it works now, thats all I care about Quote Link to comment Share on other sites More sharing options...
Garethp Posted August 21, 2009 Share Posted August 21, 2009 Besides, shouldn't it be $Config = array( 'connection'=> array(Stuff), 'Settings'=>array(Stuff), 'Name'=>array(Stuff) ); ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.