by Davo Smith.
set_config('additionalhtmlfooter', 'test');
There are hundreds (if not thousands) of working examples of using $DB->update_record() and $DB->insert_record() in the Moodle core code. Any of them should be able to help you.