cannot add or update a Child Row a Foreign key Constraint fails Laravel

Asked

Viewed 362 times

0

Guys, I have this error in my system:

cannot add or update a child row a foreign key constraint fails laravel

It informs that the ID does not exist, only that it exists. Even when I try to manually insert this error is shown.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • This message is not of non-existent ID, but of the link with another table, probably your Sert depends on something else, you have to see which table is demanding it, without details of all tables and the Insert you made there is no way to guess where the error is. This error is not with Laravel, but with your bank structure or your database.

  • I inserted, I’m sorry.

1 answer

1


Give a select in your table tbl_answers and see if the fields search_id, question_id and opcao_id are not set to 0.

If yes changes to null and tries again.

  • Thanks, I found out, I ate ball, because I’m already entering the option and did not need a relationship.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.