error/moodle/invalidqueryparam: Difference between revisions

From MoodleDocs
chris collman (talk | contribs)
bad link
Tim Bahula 2 (talk | contribs)
<syntaxhighlight lang="PHP">
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''interactive Media'''
{{stub}}
 
[[Category:Error|Invalidqueryparam]]
 
One possible cause of this error is a call like
 
<syntaxhighlight lang="PHP">
$DB->get_records_sql($sql, $params)
</syntaxhighlight>
 
where the SQL query, $sql, contains several '?' which are to be substituted by $params,
but fewer parameters than '?' are supplied.
Check that $params was not created using unexpected NULL values.
get_records_sql() is defined in 'lib/dml/*_native_moodle_database.php', depending on which database you are using.
 
[[es:error/moodle/invalidqueryparam]]

Latest revision as of 15:45, 22 May 2025

One possible cause of this error is a call like

$DB->get_records_sql($sql, $params)

where the SQL query, $sql, contains several '?' which are to be substituted by $params, but fewer parameters than '?' are supplied. Check that $params was not created using unexpected NULL values. get_records_sql() is defined in 'lib/dml/*_native_moodle_database.php', depending on which database you are using.