How to include global $DB in your file

Re: How to include global $DB in your file

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

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;


Average of ratings: Useful (1)