CodeIgniter Forums
How do you update records in intermediate tables in CI3? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: How do you update records in intermediate tables in CI3? (/thread-74958.html)



How do you update records in intermediate tables in CI3? - kangnguyen - 11-30-2019

Tables are Posts and Tags. 
One Post has Many Tags. And One Tag has Many Posts. A so-called 'Many-to-Many' relationship. 
This is solved with a intermediate table (post_tag) with id for post_id and tag_id and a created_at row. 
Now, How do you handle this in CodeIgniter? 
And before you answer. I also wish to learn how to handle updating records in intermediate table. 
As in, I remove a Post or I add a new Tag to a Post. 
Thanks,  Big Grin


RE: How do you update records in intermediate tables in CI3? - jreklund - 11-30-2019

You make INSERT and UPDATE queries to your table(s).
https://codeigniter.com/user_guide/database/query_builder.html#inserting-data
https://codeigniter.com/user_guide/database/query_builder.html#updating-data


RE: How do you update records in intermediate tables in CI3? - vincent78 - 11-30-2019

I've created an ORM for CI3

GitHub: https://github.com/vmoulin78/concorde