Jump to content

[SOLVED] What is the best way to insert into multiple tables?


rvdb86

Recommended Posts

Hi hope someone can give me any suggestions,

 

I am creating a system where I have apartments and each apartment has a type.

The apartments are stored in a table called apartments and the different types are stored in a table called types.

to link the apartments to their type i have a third table called typeLink which has the following fields:

id
apartmentID
typeID

 

the problem i have is that when i insert a new apartment into the apartment table i want to create the link at the same time. However, the apartmentID is created automatically when a new record is inserted, so how can I get the apartmentID straight after the insert query to insert it into the typeLink table.

 

I hope i have explained myself clearly.

 

Thanks in advance!

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.