Hi, I have been fiddling around with this situation for ages now and I can't seem to find a solution. I will do my best to provide the details in the best way. Say I have a file, index.php, that looks like this: <?php require('application_top.php'); require('header.php'); ?> PHP: Application_top.php looks like this: <?php session_start(); require('config.php'); ?> PHP: Config.php simply holds my database connection information. And lastly header.php holds some of the header for my template in a system I am developing. Now, I have two problems. The first one is this. Say that config.php or application_top.php held some defined variables, how can I transfer them to header.php? For example, I have $boardname defined in config.php, and in header.php I have <title><?php echo $boardname; ?></title>. It is not sending any value for the variable. My next problem is quite weird and only happened when I started meddling with my system. Basically, config.php has all my database information and connection and config.php is called in application_top.php as previously shown. My problem is that if I include application_top.php in a file and I run a MySQL query in that file, then I get errors saying that I am not connected to the database etc. This problem never used to happen but now all of a sudden I have to include config.php directly into a file if I want to query a database. Why is this? It didn't happen before and now it does. Any help will be appreciated. Thanks
I see no reason why you are having trouble with your first problem. It should work exactly as you have said. In your config file you might want to change the $boardname to define('BOARDNAME','board name value here'); PHP: and then use <title><?php echo BOARDNAME; ?></title> PHP: in your file
It all depends on whether you have your server set up correctly. If you have a web server test it on there to see if it works there
If you are still having probs with it locally, and you are using XAMPP then try WAMP instead, and vice versa
I highly recommend using OO style as if your project starts becoming complex you will just say PHP sucks