I have three php files. The "upper" file is a webpage (let's call it Sample.php). At the top of the page it does this:
<body>
<?php include("../Top.php"); ?>
//Webpage content
</body>
The Top.php file is a file with the menu and banner stored, for easy changing. The Top.php file has a line as such:
<?php include("ConnectToDB.php"); ?>
ConnectToDB.php is a file with some php code to connect to a database.
Here, the file system is ordered like so:
- RootFolder
- ConnectToDB.php
- Top.php
- OtherSample.php
- Articles
- Sample.php
When I access Sample.php I get an error in the include("ConnectToDB.php"); inside the include("../Top.php"); statement. but if I have the file OtherSample with the include("Top.php"); statement I will get no error and both Top.php and ConnectToDB.php work perfectly. What is the problem?