I have 3 tables. Company, phone, companyPhone.
The company table has an auto_increment companyID primaryKey
The phone table has an auto_increment phoneID primaryKey
The companyPhone table row is made up the companyID, and the phoneID.
On my form the user will enter company information and the company phone number.
After i insert the company row and phone row, how do i get the last ID of those tables to insert a row in my companyPhone table?
I found some documentation on the LAST_INSERT_ID() but I am not sure how to use this in my insert statements.
here are my insert statements for the company table and phone table
insert INTO `COMPANY`(`name`, `website`, `industryTypeID`, `companyStatus`) VALUES (@name, @website, @industryTypeID, @companyStatus);
insert INTO `PHONE`(`number`, `phoneTypeID`,`isDefault`) VALUES (@number, @phoneTypeID, @isDefault