Problem with field userid - Moodle 3.1+

Re: Problem with field userid - Moodle 3.1+

by Mike Churchward -
Number of replies: 0
Picture of Core developers Picture of Plugin developers Picture of Testers

Doesn't make sense the way you describe it. If the $record object contains a field 'userid' with a value (like you say it does), then it should be part of the "INSERT" command you show. Unless the data table doesn't have a 'userid' field, which it must, by the error message you posted. Are you absolutely sure that the code you displayed is the code that actually causes the error?

One thing to note, you should never use the "$_GET" globals as you are in the code you provide. You should be using the Moodle API function "optional_param" or "required_param" with appropriate arguments. See the "Don't trust any input from users" section of https://docs.moodle.org/dev/Security#Summary_of_the_guidelines.

mike

Average of ratings: Useful (2)