tables: products and images with a one to many relationship (one product, many images). There's a foreign key in the images table referencing the products table primary key.
The problem is that value isn't known until the insert is made so the rows in the images table can't reference the relevant row in products table. (Worse, if the foreign key is set to not null it won't make the insert).
What's a way to circumnavigate this?
Thanks in advance.
insert product first then you have the product key, so now you can insert the images
For starters i would not recommend using table to store images consider having a folder with your images instead save images in folder then add the folder path to your products table
Обсуждают сегодня