The error is quite clear
Quote:
Cannot add or update a child row: a foreign key constraint fails (`pertandingan`.`urusetia`, CONSTRAINT `urusetia_ibfk_1` FOREIGN KEY (`IDUrusetia`) REFERENCES `peserta` (`IDUrusetia`) ON UPDATE CASCADE)
Your table
urusetia
column
IDUrusetia
has a foreign key reference to another table
peserta
which means that the
IDUrusetia
must exist on
peserta
before you can refer to it in
urusetia
There is a better explanation here :
What is a Foreign Key? (With SQL Examples)[
^]
However, given the naming of the column and tables I suspect you have the relationship defined in the wrong direction and that
IDUrusetia
on
peserta
should be the foreign key to
urusetia
, and
IDUrusetia
on
urusetia
should be the primary key on that table. See
Difference between Primary Key and Foreign Key - GeeksforGeeks[
^]