Hello, I'm trying to make a callback function for this code.
public function trips() {
$crud = new grocery_CRUD ();
$crud->set_table ( 'trips' );
$crud->set_relation ( 'driver_id', 'users', 'name', array (
'user_type' => 'Driver'
) );
$crud->set_relation_n_n ( 'passengers', 'users_per_trip', 'users', 'trip_id', 'user_id', 'name', null, "user_type = 'Sub-manager' OR user_type = 'Passenger'" );
$crud->add_fields ( 'driver_id', 'date', 'passengers' );
$crud->display_as ( 'driver_id', 'Driver' );
$crud->display_as ( 'tax', 'Tax' );
$output = $crud->render ();
$data ['title'] = "Trips";
$this->_example_output ( $output, $data );
}
I have a 'users' table which has a 'price' field and I need to copy that value to my 'users_per_trip' table which has a 'price' field too. What I need here is that when every user is inserted in the 'users_per_trip' table the price is copied where user_id=id from table users, assuming that is a many to many relation. Hope you understand my example.
Thank you very much in advance.
