I am trying to build the database and tables for my system. But I found that if I don\'t add the foreign key in the codes. There is no error. I\'ve used many method try to make
Above answer is correct, but this error can also happen if the table your foreign key is referencing is MyISAM instead of innoDB.