php - Insert into database-Moodle -
i'm trying insert data database i'm getting error though table exist in database.
error message
table "faculty" not exist
more information error
debug info: error code: ddltablenotexist stack trace: line 1194 of \lib\dml\mysqli_native_moodle_database.php: dml_exception thrown line 19 of \local\try\process.php: call mysqli_native_moodle_database->insert_record()
codes
require_once(dirname(dirname(dirname(__file__))) . '/config.php'); global $db; $name = optional_param('name', null, param_text); $uni_id = optional_param('university_id', null, param_text); $record1 = new stdclass(); $record1->name = $name; $record1->displayorder = '10000'; $record2 = new stdclass(); $record2->name = $uni_id; $record2->displayorder = '10000'; // insert 1 record @ time. $lastinsertid1 = $db->insert_record('faculty', $record1); $lastinsertid2 = $db->insert_record('faculty', $record2); ?>
any idea why might getting this? thanks.
assuming site $cfg->prefix set 'mdl_' (the default), have double-checked table 'mdl_faculty' exists in database?
Comments
Post a Comment