Home >Database >Mysql Tutorial >How to Resolve 'Cannot Add or Update Child Row: Integrity Constraint Violation'?
Solution "Can't add or update sub -line: Potal constraints conflict" error
When inserting the data in a table containing the outer key constraints, the conflict error may be encountered. This error message indicates that due to the failure of external keys, it cannot be added or updated.
For example, try to insert a line to the
table, the table has the outer key constraint of the table. The error occurred because the value you inserted in does not exist in the comments
table. projects
project_id
To solve this problem, please make sure that the value you inserted for projects
is in the
table before you can insert it into the project_id
table. projects
projects
The following is an example of operation: comments
By ensuring the corresponding records in the parent table, this error can be avoided. Please check your data and make sure that the ID value referenced by the outer key already exists in the parent table.
The above is the detailed content of How to Resolve 'Cannot Add or Update Child Row: Integrity Constraint Violation'?. For more information, please follow other related articles on the PHP Chinese website!