I have three tables: preco
, estabelecimento
and precoXestabelecimento
. The id
of price is autoincrement
and there is a N: N relationship between the first two tables, which is represented by the third precoXestabelecimento
table.
For a price to be saved it is necessary to have an establishment connected to it, so the moment a price is saved I need to get its ID along with the establishment ID and save in the 3rd table. The problem is that I do not know how to get the price ID since its value is autoincrement
and has not been saved to the database yet.