moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Usage page DB errror when using mysql #25

Closed jason-platts closed 10 years ago

jason-platts commented 10 years ago

Reported by Guido Gautsch:

Default exception handler: Error reading from database Debug: Unknown column 'count' in 'order clause'\n\n SELECT count(ff.id), fp.id\n from mdl2_forumng_flags ff\n inner join mdl2_forumng_posts fp on fp.id = ff.postid\n inner join mdl2_forumng_discussions fd on fd.id = fp.discussionid\n where fd.forumngid = ?\n and fd.deleted = 0\n and fp.deleted = 0\n and fp.oldversion = 0\n \n group by fp.id\n order by count desc, fp.id desc LIMIT 0, 5\n[array (\n 0 => '6',\n)]\nError code: dmlreadexception\n* line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown\n* line 933 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 310 of /mod/forumng/feature/usage/usage.php: call to mysqli_native_moodle_database->get_recordset_sql()

Probably should be "count(ff.id) as count" (in postgres you don't need to do this, might not be the same in mysql)

jason-platts commented 10 years ago

Fixed: https://github.com/moodleou/moodle-mod_forumng/commit/d7d65ffefdd4d365fb7270d1493801cad121d6ed