tHud Posted September 18, 2010 Share Posted September 18, 2010 I'm really embarrassed asking this.. I have two files. config.php & program.php config.php <php $max_columns = 3; ?> program.php <?php include ('config.php'); echo $max_columns; ?> I can't get the script to echo anything. I have tried... $max_columns = '3'; $max_columns = "3"; include_once include ("config.php"); include ('/path/to/file/config.php'); require .....etc. etc. Any thoughts? PLEASE, I'm going nuts here. Thanks for you patience with what must be a very trivial question for you guys Quote Link to comment https://forums.phpfreaks.com/topic/213748-include-a-config-file/ Share on other sites More sharing options...
Username: Posted September 18, 2010 Share Posted September 18, 2010 uhh. Even I don't know what to do.. You're doing it right... try CONFIG: <?php $max_columns = "3"; ?> PROGRAM: <?php include('path/to/config.php'); echo $max_columns; ?> it works fine on my host.. edit: what premiso said. Quote Link to comment https://forums.phpfreaks.com/topic/213748-include-a-config-file/#findComment-1112533 Share on other sites More sharing options...
premiso Posted September 18, 2010 Share Posted September 18, 2010 In your config.php it seems you may have a syntax error: <php should be <?php Not sure if this is it, but that would be my first look. (Unless it is a typo). Quote Link to comment https://forums.phpfreaks.com/topic/213748-include-a-config-file/#findComment-1112535 Share on other sites More sharing options...
tHud Posted September 18, 2010 Author Share Posted September 18, 2010 In your config.php it seems you may have a syntax error: BANG - (sound of OP shooting himself in head.) Doesn't matter what I changed after the first mistake was made sometimes you can't see the wood for the trees Thank you for taking the time to answer Quote Link to comment https://forums.phpfreaks.com/topic/213748-include-a-config-file/#findComment-1112547 Share on other sites More sharing options...
Username: Posted September 18, 2010 Share Posted September 18, 2010 In your config.php it seems you may have a syntax error: BANG - (sound of OP shooting himself in head.) Doesn't matter what I changed after the first mistake was made sometimes you can't see the wood for the trees Thank you for taking the time to answer Haha, glad you solved your problem; you should mark the topic as solved! Quote Link to comment https://forums.phpfreaks.com/topic/213748-include-a-config-file/#findComment-1112548 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.