I am getting Error writing to database in moodle:
Code:
if (is_siteadmin()) {
class addschedule_form extends moodleform {
function definition () {
$mform =& $this->_form;
$mform->addElement('text', 'id', 'Enter ID:');
$mform->setType('id', PARAM_TEXT);
$this->add_action_buttons(true, 'submit');
}
}
$ti_form = new addschedule_form();
$ti_form->get_data();
if ($ti_form->is_cancelled()) {redirect('index.php');}
if ($recs = $ti_form->get_data()) {
$deleteit = $DB -> delete_records('DELETE * FROM `mdl_schedules` WHERE id = ' . $recs -> id . '');
redirect('schedule.php');
}
}
else { }
$ti_form->display();
What could be the reason? Any reference or help will be much appreciated.
Regards