I am trying to create a statement so that when the submit button is pressed the data is passed into both tables (properties, frent).
The PK is automatically added to the properties table. This PK then needs to be pulled and added to the frent table as FK, along with the rest of the data submitted.
When I modify the statement to insert data into only the properties table it works fine. However when the information for the second table is entered everything stops working. I know there must be something wrong with the statement but I don't know what. I would be grateful for any advice. thank you in advance.
PropertyID is the PK for properties and the FK for frent. It is an auto increment which is why it is not included in the first section of the code.
The Statement I am trying to create:
$sql = "START TRANSACTION ;
INSERT INTO properties ( PropertyType, AH, Bedrooms, Bathrooms, Ensuite, Kitchen, LivingRoom, DiningRoom, UtilityRoom, Conservatory, Garage, Garden, Parking,Furnished, Description, PostCode, AddL1, AddL2, AddL3,Area,County,Country)
VALUES( '$PropertyType', '$AH', '$Bedrooms','$Bathrooms', '$Ensuite', '$Kitchen', '$LivingRoom', '$DiningRoom', '$UtilityRoom', '$Conservatory', '$Garage','$Garden', '$Parking','$Furnished', '$Description', '$PostCode','$AddL1', '$AddL2', '$AddL3','$Area','$County','$Country');
INSERT INTO frent (FRent,LAST_INSERT_ID(PropertyID), MinCon, PaymentExp, RCost)
VALUES ('FRent','$PropertyID', '$MinCon', '$PaymentExp','$RCost');
COMMIT";