How to update a n n relation table
- Single Page
Posted 15 July 2015 - 23:47 PM
Posted 16 July 2015 - 00:00 AM
Hi! See docs on the grocery crud site and if after u will have a questions, write here :)
Posted 16 July 2015 - 12:53 PM
Posted 16 July 2015 - 17:08 PM
All u can do that only add values before in related table and than update in current. Dynamicly add values u cant. But I guess I saw here on the forum similar question... so let search
Posted 18 July 2015 - 11:58 AM
Hi
I am having a similar case and I agree with Paul: it seems there is no way to automatically update it. So, I am implementing both updates to "master" and "relation" table in the same callback. However, I am having problems to get selected items. For the "main" table, I am referring to $post_array['first_name']
to get the entered value, but for the selected entries (as I may have several), I understand I should get an array with selected ones: could someone provide an example??
$this->grocery_crud->set_relation_n_n('assignedgroup','users_groups', 'groups', 'group_id', 'user_id', 'description'); $this->grocery_crud->display_as('username','Identificador'); .... $post_array['username'] foreach ($post_array['assignedgroup'] as $assigned)
Posted 18 July 2015 - 17:35 PM
I am not clearly understand your logic, can u explain more?