Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7882547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:18:42+00:00 2026-06-03T04:18:42+00:00

I have three php files. The upper file is a webpage (let’s call it

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:18:43+00:00Added an answer on June 3, 2026 at 4:18 am

    The “include” statements actually ports the code into your page. So keep in mind that include("ConnectToDB.php") is executed from Sample.php, therefore the path is wrong.

    The correct line of code would be: include("../RootFolder/ConnectToDB.php")

    where .. represent the whole dir structure after "localhost/" or whatever you are using.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have three files index.php file.php and fns.php First example (it works): index.php
I have a main.php file which has the following three included php files: <!--TAB
I have three files: one called sql.php witch has a class db that I
I have three files in a folder 'test' one.php two.php print.html And i have
I have three php pages. First is a selection.php page with options selected by
i have a problem, can't understund anyway. i have three files - index.php ,
I've been trying my hand at OO PHP, and currently have three files. I
I have three PHP files: 1.php - Version 1.0 of OSS software (vanilla) 1a.php
So i have three files. FILE 1 includes FILE 2 which includes FILE 3
I have three files; index.php, searchbar.php and search.php now when i have search.php show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.