General developer forum

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

 
Picture of Darko Miletić
Re: Using Moodle DB object for external/ non native DB table ?
Core developersParticularly helpful Moodlers

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.




 
Average of ratings: -