Good morning, i have a big problem with this sql error when i,m trying to insert a event in my database with this pdo:
$subsquery1 = \"SELECT cat_id
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (datenbank.events, CONSTRAINTevents_ibfk_1FOREIGN KEY (event_cat) REFERENCEScategories(cat_id)
You are performing an insert to table events
with a value being placed in column event_cat
.
That value does not already exist in table categories
in the column cat_id
.
And you said it must. So the db engine says it won't do it. It is faithfully obeying your orders.