Thanks for the article, I don't know how well you know this, but in the MyISAM example they give, it says to create 2 primary keys for the IDs on the child table (one to set as the trigger referenced from the parent table).
However, my MySQL won't allow 2 primary keys to be set on the same table. I don't know if this is something I have to change with some sort of override, which I wouldn't feel confident in doing, or if it's because I've already created my tables, and would have to delete them and start from scratch?
Also, if I already have my tables created, how do I add the trigger to an existing field/table? I think this tutorial assumes the tables have not been created yet.
Here they give the example in 3 steps:
CREATE TABLE myisam_parent
(
mparent_id INT NOT NULL,
PRIMARY KEY (mparent_id)
) ENGINE=MYISAM;
CREATE TABLE myisam_child
(
mparent_id INT NOT NULL,
mchild_id INT NOT NULL,
PRIMARY KEY (mparent_id, mchild_id)
) ENGINE = MYISAM;
CREATE TRIGGER insert_myisam_child
BEFORE INSERT
ON myisam_child
FOR EACH ROW
BEGIN
IF (SELECT COUNT(*) FROM myisam_parent WHERE mparent_id=new.mparent_id)=0
THEN
INSERT error_msg VALUES ('Foreign Key Constraint Violated!');
END IF;
END;