From: stronk7 Date: Mon, 8 Oct 2007 17:42:46 +0000 (+0000) Subject: ANSI join ON clauses should contain only the join condition. Also, X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=115a43113a46c676e9b66ae77db1d5727a595fca;p=moodle.git ANSI join ON clauses should contain only the join condition. Also, added prefix to the ORDER BY to prevent duplicate names. --- diff --git a/lib/datalib.php b/lib/datalib.php index 46ecc03057..fb84762ac4 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -907,10 +907,10 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL $sql = "SELECT cc.id, cc.path, cc.visible, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth as ctxdepth, ctx.contextlevel AS ctxlevel - FROM {$CFG->prefix}course_categories cc - JOIN {$CFG->prefix}context ctx - ON (cc.id=ctx.instanceid AND ctx.contextlevel=".CONTEXT_COURSECAT.") - ORDER BY id"; + FROM {$CFG->prefix}course_categories cc + JOIN {$CFG->prefix}context ctx ON (cc.id = ctx.instanceid) + WHERE ctx.contextlevel = ".CONTEXT_COURSECAT." + ORDER BY cc.id"; $rs = get_recordset_sql($sql); // Using a temporary array instead of $cats here, to avoid a "true" result when isnull($cats) further down