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, CONSTRAINTrestaurant_food_id_foreignFOREIGN KEY (Food_id) REFERENCESfood(Food_id)) Where is the problem in my DB?I am using llaravel.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire