I have added a new field in db mdl_resource and similarly i have added a new radio button for the field on form (add resource for course),now where to write code to insert value of this new field to db.
Is there any generic method to update databases or at form level only i have to write code to insert such fields and how??????????
Thanks
Without more information it's very difficult to say where you need to add the code.
Also, I'd be VERY careful when adding new fields to the database. It could cause problems in the future when you need to upgrade Moodle.
We discussed this at the Yorkshire/Humberside Moodle User Group a couple of months ago - as long as you document the changes you made and where you should be ok for upgrades. And make sure you're backing up the column of database you've added in SEPARATELY to the main database backups for importing to an upgrade.
Thanks for response.
Actually I have added a field in moodle/mod/resource/mod_form.php and respective field in DB mdl_resource, but where to write query to insert value of this new field to DB. May be i have added field in wroung place or i don't know how to relate field with DB in moodle.
leena
Actually I have added a field in moodle/mod/resource/mod_form.php and respective field in DB mdl_resource, but where to write query to insert value of this new field to DB. May be i have added field in wroung place or i don't know how to relate field with DB in moodle.
leena
I think that if the column has the same name as the form field, the insert will happen automatically.