$crud->field trouble error
- Single Page
Posted 17 September 2012 - 06:46 AM
I'm new in grocery CRUD and I have trouble inserting data into database with these following code:
[quote]function school_years_display() {
$this->load->library('grocery_CRUD');
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('school_years');
$crud->set_subject('Tahun Ajaran');
$crud->columns('school_years','odd_semester_start','odd_semester_end','even_semester_start','even_semester_end','active_semester');
$crud->required_fields('school_years','odd_semester_start','odd_semester_end','even_semester_start','even_semester_end');
$crud->fields('school_years','odd_semester_start','odd_semester_end','even_semester_start','even_semester_end');
$output = $crud->render();
$this->_crud_output($output);
}[/quote]
but after i comment these line, now i can inserting data into database normally
[i] $crud->fields('school_years','odd_semester_start','odd_semester_end','even_semester_start','even_semester_end');[/i]
Posted 17 September 2012 - 08:40 AM
You show this fields:
$crud->columns('school_years','odd_semester_start','odd_semester_end','even_semester_start','even_semester_end','active_semester');
Although maybe is necessary to set a value for all columns although not used.
Posted 18 September 2012 - 00:26 AM
I try to use $crud->field method to another controller and it works as usual. But not with school_years controller. I already set the default value by null in database, it should be okay if i not included those field in CRUD.
Thanks anyway for your kindly reply