Unknown column 'm.course' in 'where clause'

Unknown column 'm.course' in 'where clause'

by James Hamilton -
Number of replies: 5
Hi All, I'm facing this issue when attempting to delete a course and would appreciate any tips or suggestions on how to resolve it:

Error reading from database

Debug info: Unknown column 'm.course' in 'where clause'
SELECT cm.*, m.id AS modinstance, m.name, 'edwiserform' AS modname
FROM mdl_edwiserform m
LEFT JOIN mdl_course_modules cm ON cm.instance = m.id AND cm.module = ?
WHERE m.course = ?
[array (
0 => '24',
1 => '18',
)]
Error code: dmlreadexception
Stack trace:
  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1245 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 5145 of /lib/moodlelib.php: call to mysqli_native_moodle_database->get_records_sql()
  • line 5031 of /lib/moodlelib.php: call to remove_course_contents()
  • line 68 of /course/delete.php: call to delete_course()
Moodle 3.7.1

Average of ratings: -
In reply to James Hamilton

Re: Unknown column 'm.course' in 'where clause'

by Ken Task -
Picture of Particularly helpful Moodlers

Don't have Edwiser - WP front end for selling Moodle courses?

See 2 tables involved (jot down the course ID number):

mdl_edwiserform and mdl_course_modules

Might have to use mysql client tool of some short to view those tables for course id number for more info.

'SoS', Ken


In reply to Ken Task

Re: Unknown column 'm.course' in 'where clause'

by James Hamilton -
Ken, as usual thanks for the pointers. Would a collation mismatch have something to do with it? I shall try fix that before I continue in any case (it's *long* overdue).
In reply to James Hamilton

Re: Unknown column 'm.course' in 'where clause'

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

My uninformed guess would be that mdl_edwiserform doesn't have a field called course

But you would need to supply more information on how you got to this point. Also Edwiser is not a part of core Moodle and so you are more likely to get help from the people who create it.

The code looks odd as by convention you wouldn't alias a field called mdl_edwiserform with m  it would be more common to use something like ef, but again that is guesswork.


In reply to Marcus Green

Re: Unknown column 'm.course' in 'where clause'

by James Hamilton -
Thanks Marcus appreciate the feedback, I've submitted it to to the plugin developers for their feedback too. As for how we got here: trying the delete a course that at some point in time used the RemUI course theme, and then getting the above errors even when changing the course theme to topics.
In reply to James Hamilton

Re: Unknown column 'm.course' in 'where clause'

by Sarang Nair -

Hi @James,

This issue occurs when all the files of Edwiser Forms are not installed on your end. If you install all the files of Edwiser forms then it will resolve the issue.

You might have added some activity in the course using Edwiser Forms PRO and then one of the files might be deleted which could have caused the issue.

Let me know if you are still facing the issue.