How can I find the current user's expiry date on the current course?
I've started writing a block which is intended to do this but I'm struggling with the SQL.
$sql = "SELECT enrol.enrolstartdate, enrol.enrolenddate FROM {enrol}<br />
INNER JOIN {user_enrolment}
ON user_enrolment.enrolid= enrol.id
WHERE user_enrolment.userid=? AND enrol.courseid=?";
$result = $DB->get_record_sql($sql, array($USER->id, $COURSE->id) );
This doesn't work.
Any ideas anyone please?
Cheers
Dave