require_once(__DIR__.'/../../config.php');
(Adjust the number of '/..', based on how many subdirectories are between the file and config.php).
Inside a function you'll need to write:
global $DB;
require_once(__DIR__.'/../../config.php');
(Adjust the number of '/..', based on how many subdirectories are between the file and config.php).
Inside a function you'll need to write:
global $DB;