It has been covered many many times on several sites, explaining how to define DRUPAL_ROOT and bootstrap the page (whatever that actually means). However no one has ever said how to use it in a separate PHP file.
I am trying to use a php file as my data layer in a custom module. However when I use define('DRUPAL_ROOT', getcwd()) it comes back with the directory of the module (as expected). If I use $_SERVER['DOCUMENT_ROOT'] it comes back with the www HTML folder and not my drupal install folder.
If I add .base_path() it doesnt know what the hell that is! I can't just had code it because it's going to another IT team and I have no idea what their file structure is like.
Please, can anyone help! I am going insane!!
Its just a standard php file with some db_query's in. This really can't be as hard as I'm making it, can it?