CodeIgniter Forums

Full Version: How to insert in OneToMany relationship
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to is posible insert in relationship one to many.



Please tell us what you are trying to do, if you just give a schema table without detail explanation we can't help you !
You have to insert the data in order to get the ID values required for the tables which manage the relationship(s) between the other tables. In other words, you would insert your data for table_movie and table_format, getting the id value for each after performing the insert, then you would insert those two id values into table_movie_format. If you insert multiple formats for a movie, you would insert the movie and get the id. Then insert a format, get the format's id, insert the two id values into table_movie_format, then repeat for each format (using the same movie id).