Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 38395

Re: Access Moodle DB From Block Code

$
0
0
by Mark Williamson.  

I have successfully managed to pull data out of the DB now. However, when I try insert or update any kind of data I get an error. Coding error detected, it must be fixed by a programmer: moodle_database::update_record_raw() id field must be specified.

I have tried the following code:

$record = new stdClass();
$record->id = '266';
$record->name = 'additionalhtmlfooter';
$record->value= 'test';
$DB->update_record('mdl_config', $record, $bulk=false);

 

I tried example code shown on the link you provided which also does not work. I assume with the example of $record->name, name should match a column in the db on table mdl_config. Would that be right? Could someone give me an example of how to update / insert data into db. 

Best,

Mark

 


Viewing all articles
Browse latest Browse all 38395

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>