Foreign Key Exception on Id when attempting to insert
I am getting the following exception when trying to insert records into my video_genres table:
And here is my .sql table:
7 Replies
More information: It's happening in a function that also handles the creation of the videos, and then attempts to link the genreId and videoId in the video_genres table.
Essentially we have data creating record A and using that same data we are trying to create record B (maybe even C, D, E ..)
it sounds like you are trying to add a row in
video_genre
with a value for video_id
which does not exist in videos
Is that because it has not been made yet for some reason?
Oh wait
The Id seems to be 0..
And I think it gets set after its record is created in the DB
unless you set it somewhere, it wont be set
This got solved by the way, thanks for your time.