Thank you for the reply.
3. OK I will try doing that.
2. Ok
1. I understood it but the thing is I want to supply a value to that nick_name field in film_actor table while updating films table i.e when I am inserting a new film I choose an actor from actors table then enter the nick_name.
Additional questions:
1. I am trying to use callback_after_insert function to update but it does not work, find my codes below
function transaction_management() {
try {
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('financial_transactions');
$crud->set_subject('financial_transactions');
$crud->set_relation('transaction_type_code', 'transaction_type', 'transaction_type_description');
$crud->set_relation_n_n('accounts', 'accounts_in_transactions', 'chart_of_accounts','transaction_id','account_number','account_name');
$crud->set_relation('party_id', 'members', 'first_name');
$crud->columns('transaction_type_code','transaction_date','amount','party_id','accounts');
$crud->callback_after_insert(array($this, 'multi_tran_after_insert'));
$output = $crud->render();
$this->_example_output($output);
} catch (Exception $e) {
show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
}
}
function multi_tran_after_insert($post_array,$primary_key) {
$cash_data = array(
'transaction_id' => $primary_key,
'account_number'=> '1',
'amount'=> $post_array['amount'],
'transaction_nature'=> 'Dr'
);
$update_data = array(
'amount1'=> $post_array['amount'],
'transaction_nature'=> 'Cr'
);
$test_data = array(
'first_name'=> 'tested'
);
$this->db->trans_start();
$this->db->insert('accounts_in_transactions', $cash_data);
$this->db->where('transaction_id', $primary_key);
$this->db->update('accounts_in_transactions', $update_data);
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
return FALSE;
} else {
return TRUE;
}
}
I do not know why my callback_after_insert function is not called and executed.
Please help me analyse the codes above as it will be the alternative solution to questions asked earler.
Thank you