Between CarTbl
and CarImagesTbl
is a one-to-many relationship. The primary key of CarTbl
will be foreign key in CarImagesTbl
, this way you will be able to identify to what car does belong each image.
After you insert the car into database, you get its primary key, and looping trough the array of imagesURL, you insert the values in the CarImagesTbl. To get the images for one specific car, you do a join between the tables
Select URL,CarID
From CarImagesTbl ci, carTbl c
Where c.carId = ci.carId_FK
and c.carId = wantedCarId