callback_after_update
void callback_after_update(mixed $callback )
Quick Description: This is a callback that is used after the automatic update of the CRUD.
This is a callback that is used after the automatic update of the CRUD. The function of the callback takes two parameters , 1 - the post data and 2 - the primary key value . Return value for this callback is not required.
Example:
public function users() { $crud = new grocery_CRUD(); $crud->set_table('users'); $crud->set_subject('User'); $crud->required_fields('username'); $crud->columns('username', 'email', 'real_name', 'active'); $crud->fields('username', 'email', 'password', 'real_name', 'active'); $crud->callback_after_insert(array($this, 'log_user_after_insert')); $crud->callback_after_update(array($this, 'log_user_after_update')); $output = $crud->render(); $this->_example_output($output); } function log_user_after_update($post_array,$primary_key) { $user_logs_update = array( "user_id" => $primary_key, "last_update" => date('Y-m-d H:i:s') ); $this->db->update('user_logs',$user_logs_update,array('user_id' => $primary_key)); return true; }