This Question have no Text answers yet!

Strange foreign Key error only on specific records

By : Eric C

I have a foreign key error using a status table.

mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ID137594_gronden.project, CONSTRAINT project_fk_status FOREIGN KEY (statusID) REFERENCES status (id)). Failing Query: "UPDATE project SET verkoperid = 1, adres = 'test 123', gemeenteid = 2121, statusid = '18', statusdescription = '123', oorsprongdossierint = 1, modifydate = '2016-09-28', manualdate = '2012-02-07', info = '1' WHERE (id = 449)"'

As you see I use statusID 18, updating the project and changing the status. I have 2 tables in this example, the project table and the status table. Within the status table the customer can manage the different statuses of a project. Within the project field they can add the correct status. In the status table I have 18 records.

Now what is strange, only when using status with IDs 16, 17 en 18 give me this foreign key error. Using any other status, I have no issue.

How to get this solved?


By : Eric C

Video about Strange foreign Key error only on specific records