I am creating a basic structure for my site and I have a config.php stored in the scr directory. In addition, in this directory there is a folder called php , where I store a file called sidebar.php
Basically, the config.php will contain my database configuration variables and is also the only file that every page invokes. I want to include php/sidebar.php in this file so that any variables that I create in sidebar.php can be used on all pages.
However, I also want sidebar.php have access to database configuration variables. Thus, these two files will effectively include each other.
Enable from configuration on sidebar:
include 'php/sidebar.php';
From sidebar to configuration:
include '../config.php';
However, the above statement (sidebar to config) gives the following error message:
Warning: enable (../config.php) [function.include]: failed to open Stream:
There is no such file or directory in C: \ XAMPP \ site \ ecr \ PHP \ sidebar.php on line 3
I'm going to all this incorrectly cross-link two files, or is there a decent reason why it doesn't work
source share