vendredi 29 juillet 2016

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`foodsuggestion

I have a table Food having fields:

  • FoodID(PK)
  • FoodName
  • CategoryID(FK)
  • ResID(FK) And other table is Restaurant having fields:
  • ResID(PK)
  • ResName
  • FoodID(FK) When I insert data to any table it gives error like:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (foodsuggestion.restaurant, CONSTRAINT restaurant_food_id_foreign FOREIGN KEY (Food_id) REFERENCES food (Food_id)) Where is the problem in my DB?I am using llaravel.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2aBhulq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire