I have 3 files: home, failed_attempt, login.
The file home and failed_attempt all refer to login file.
The annoying thing is that they throw a mistake saying that the login file doesnt exist. home will throw an exception if i do this, but failed_attempt wont.
include_once("../StoredProcedure/connect.php");
include_once("../untitled/sanitize_string.php");
and if I do this:
include_once("StoredProcedure/connect.php");
include_once("untitled/sanitize_string.php");
the opposite happens, failed_attempt throws an exception , but home, wont. How do I fix this..
Do I tell the include to go up a page by putting this ../ , and therefore home.php doesnt need to go one page up therefore it throws that exception..
How can I make it so both files accept those inclueds as valid.. perhaps not relative to where they are placed.. i.e. without that ../
Directory structure:
PoliticalForum
->home.php
->StoredProcedure/connect.php
->untitled/sanitize_string.php
->And other irrelevant files
For the beginners this will help to understand. Use simply the following based on your relative path:
//include file directly from parent directory:
include_once(dirname(__FILE__) . '/../connect.php');
OR
//include file from parent's child directory:
include_once(dirname(__FILE__) . '/../StoredProcedure/connect.php');
OR
//include file from own child directory:
include_once('StoredProcedure/connect.php');
OR
//include sibling files from same directory:
include_once('connect.php');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With