Had a problem getting external enrollments to work to an external MySql database.
Traced the problem to the database enrollment in this file:
enrol/database/enrol.php (enrol.php,v 1.7 2005/02/08)
I finally determined the problem could be fixed in the workaround hack section which prefixed the table name with the database name for the course select query which looks up the course by the idnumber. The query that was formed looked like this:
SELECT * FROM MOODLE1-5-DEV.mdl_course WHERE idnumber='8194'
To our database (MySql version 4.1.10a-standard) this is syntax error unless the table name is enclosed with the back tick '`' character:
SELECT * FROM `MOODLE1-5-DEV`.mdl_course WHERE idnumber='8194'
I modifed the enrol.php code from:
$CFG->prefix = $CFG->dbname.$CFG->prefix;
$CFG->prefix = `$CFG->dbname`.$CFG->prefix;
And now enrollments work ok.
I'm not sure if the back tick is valid for other databases, i've only been concerned with MySql and this fix worked for me.