title: including multiple files in different directories php
body: <p>I am have trouble including files containing functions. I have a file called blog.php that runs the following:</p>
  
  <pre><code>&lt;?php
  require 'db.php';
  require 'functions.php';
  
  //Connect to the DB
  $conn = Blog\DB\connect($config);
  if ( !$conn ) die('Problem connecting to the db.');
  </code></pre>
  
  <p>The blog.php file is in the blog folder. Inside the blog folder is an admin folder containing an index.php file with the following code:</p>
  
  <pre><code>&lt;?php
  require '../blog.php';
  </code></pre>
  
  <p>This should allow me to call the blog.php which then calls the db.php file which contains my database connection functions but I am getting an error that the connect function is undefined . It's trying to require db.php from the blog>admin folder, not from where the blog.php file is located (which is the same directory as db.php)? How can I fix this?</p>