I have 2 tables in which one column in one table will reference one in another table.
I would like to know how can I make table B (referenced)‘s column data changed whenever table A(referencing)‘s column data is changed
That is
A [a1, a2]
a1 = {1,2}
B [b1, b2]
b1 is referenced by a1, and b1 = {1,2} therefore if I change a1 values using phpmyadmin to {2,5} then click save, after that I would like b1’s values are automagically changed too.
Update:
Now it works, but I don’t see any referenced data in the second table? I mean the values of b1 is empty, It should be the same with a1 I think.
To do this, create the foreign keys with
ON UPDATE CASCADE(requires InnoDB for the storage engine, but that’s a good default).