I'm working on my first major database design with junction tables in CodeIgniter, and I'm not too sure how to handle data insertion.
Let's say I have two tables, some_table
& another_table
, with a junction table, some_another
. Now if I want to add a record to some_table
, do I also write separate insertion queries for the junction table, or is there a better, more automated way to handle this?
For example, do I have to do this:
INSERT INTO some_table (col1, col2, col3) VALUES (val1, val2, val3)
INSERT INTO some_another (col01, col02) VALUES (val01, val02)
for each record, or is there a way or a tool that handles also updating junction tables for me?
If there's any other info I should provide, please let me know. Thanks!