Let's say i have 3 tables.
CREATE TABLE viewer ( id INT NOT NULL PRIMARY KEY, name VARCHAR(45)) CREATE TABLE movie ( id INT NOT NULL PRIMARY KEY, title VARCHAR(45)) CREATE TABLE viewer_watched_movie ( viewer_id INT NOT NULL, movie_id INT NOT NULL, liked TINYINT(1), PRIMARY KEY (viewer_id, movie_id), CONSTRAINT fk_viewer_watched FOREIGN KEY (movie_id) REFERENCES movie (id) CONSTRAINT fk_movie_watched_by FOREIGN KEY (viewer_id) REFERENCES viewer (id))
I have a CRUD for viewer_watched_movie. Now what i want is, that the user can create viewer_watched_movie and select the viewer from a dropdownlist, which works fine, and to select the movie from a cgridview. The id from movie should then be saved to user_watched_movie. How should I do that or If there is a better way of getting the id, please let me know.