Database Insert

Database Insert

by Vinayan Ramchandran -
Number of replies: 1

Hi

moodle:2.6.2+

THEME:gourmet

I am building a theme plugin.I wanted just to do a simple insert into the database. I created the tables and fields using XMLDBEditor, but could not see the table in the 'moodle' database. So I did it manually.

I wrote the following code:

global $DB;

$record = new stdClass();
$record->course_id = $courseid;
$record->course_name = $coursename;

$user = $DB->insert_record('course_mgnt', $record);

print_r($user);

---------------------------------------------------

I am getting the error as follows:

 

Please do help

Regards

Vinayan R

Average of ratings: -
In reply to Vinayan Ramchandran

Re: Database Insert

by Adrien Jamot -

Hi,

If you have created the table manually, I think you have to purge all Moodle caches.

 

Adrien