zeldaze
Sep 20th 2008, 5:57 am
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');
?>
Application_top.php looks like this:
<?php
session_start();
require('config.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 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');
?>
Application_top.php looks like this:
<?php
session_start();
require('config.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 :)