Using Moodle DB object for external/ non native DB table ?

Re: Using Moodle DB object for external/ non native DB table ?

by Darko Miletić -
Number of replies: 0

You can try this:

$oldprefix = $CFG->prefix;
$CFG->prefix = 'myprefix_';
$DB->something;
$CFG->prefix = $oldprefix;

You should also place appropriate try/catch and ensure that no exception leaves your code. You must also guarantee that $CFG->prefix will be set to original state.


This is still extremely bad idea.