Похожие чаты

Hey guys. I have a MySQL question. I have two

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.

2 ответов

10 просмотров

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

Похожие вопросы

Обсуждают сегодня

Is UniBright Freequity an active live product ? A friend here in Asia was discussing the Tokenisation of RWA’s in his case Real Estate as he’s a developer with numerous overs...
Digital Trust
4
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
Hi, is it fine to use git to backup my config? I did so many things that I don't want to miss if I switched to another OS, so how do you backup your home and configs? And shou...
Adnan Al_Beda
30
Добрый день задумываюсь о создание токена из за того что много свободного времени и вот я узнал что транзакции за перевод этого токена будут в waves и тут пришла идея при тран...
Артем
3
Zapper планирует свой токен. Агрегатор DeFi и трекер портфолио портфелем ценных бумаг Zapper представил протокол Zapper, целью которого является стимулирование и контекстуал...
Foxcool
3
А если изначально бот работал так : есть сайт онлайн школы. У каждого ученика свой кабинет. Где он авторизуется по своим данным. И уже в кабинете, на самом сайте делает оплату...
Денис 💡 Фрилансер
13
Hi, I am a bit confused... I just unbonded on app.persistence.one stkSTARS/STARS with a liquidity of $127. From a time period of 60 days and a reward percentage of 9.72% at t...
Matias
6
Добрый день Хочу начать обучение языку, не являюсь представителем it, буду благодарна за помощь, совсем пока не понимаю ничего) Подскажите, пожалуйста, где можно начать первы...
Sara Lala
19
А что ты вообще делаешь ?
Yesgoter
13
средствами IBX как-то можно выполнить запрос insert ... returning?
Igor
31
Карта сайта