function placehistory() { $crud = new Grocery_CRUD(); $crud->set_table('place_history'); $crud->columns('province','municipality','barangay','land_area','population','year'); $crud->set_relation('place_id','place','{province} {municipality} {barangay}'); $crud->callback_column('province',array($this,'_callback_view_province')) ->callback_column('municipality',array($this,'_callback_view_municipality')) ->callback_column('barangay',array($this,'_callback_view_barangay')); $crud->fields('place_id' ,'province','municipality','barangay','land_area','population','year'); $crud->field_type('place_id','invisible'); $crud->callback_before_insert(array($this,'_callback_placeID')); $crud->callback_field('province', array($this, '_callback_province')); $this->dependent_dropdown_place($crud); //dependent dropdowns for province, municipality, and barangay }
Place_id is a primary key and is also a foreign key in the main table. I have displayed all columns -barangay, municipality, and province - from the table which place_id is the pk. I have successfully "join" the 2 tables for viewing purposes using callback columns. However I cannot insert or update data successfully. There is also no either success or error messages or debugging messages from firebug so I'm having a hard time identifying and fixing the problem. Can anyone help me?
Above is my controller code. Below is my callback code before insert:
function _callback_placeID($post_array, $primarykey) { $prov = $this->input->post('province'); $mun = $this->input->post('municipality'); $bar = $this->input->post('barangay'); $post_array['place_id']=$this->shared_model->find_place_id($prov, $mun, $bar); return $post_array; }
Thank you very much in advance for your help :)