Moodle | Call to undefined method mysqli_native_moodle_database :: insert_records()

| By Webner

We were using insert_records() function to insert multiple records in a Moodle database table but it was not working.

We checked for errors by adding following lines in config.php file of moodle:

@error_reporting(E_ALL | E_STRICT);

@ini_set('display_errors', '1');

$CFG->debug = (E_ALL | E_STRICT);

$CFG->debugdisplay = 1;

Note : These lines should be used just before the following line:

require_once(dirname(__FILE__) . '/lib/setup.php');

On running the code now following error was flashed on the screen:

Fatal error: Call to undefined method mysqli_native_moodle_database::insert_records()

On further checking we found that error was due to using an older version of moodle (2.6) while this function is only supported in moodle version 2.7 and higher.

Leave a Reply

Your email address will not be published. Required fields are marked *