I have three tables in my database. All three are tied together by a foreign key referencing the main table. Main table (CompanyData) has primary key (companyID). Two child tables (RepData and ContactData) each have foreign keys (ID_company) that references the main table's primary key.
CompanyData owns ContactData (OnetoOne) and CompanyData owns RepData (OnetoMany).
Now, I can physically add to each table using phpAdmin with no problem. However, I can not do it through a form. The form is working and was just fine before I added the relationships. Since then, I get:
"Cannot add or update a child row: a foreign key constraint fails (`reviewmy_jos1`.`dataContact`, CONSTRAINT `FK_contactid_companyid` FOREIGN KEY (`id_company`) REFERENCES `dataCompany` (`companyID`) ON DELETE CASCADE ON UPDATE CASCADE) "
What I don't understand, how could it work perfectly fine through phpAdmin when inserting the data but not when inserted through the form?
Also, if it makes a difference I'm using MariaDB.
What I have tried:
Works in phpAdmin when inserting data does not work in form when inserting data since adding the relationships.