title: ERROR #1452: Cannot add or update a child row: a foreign key constraint fails
body: <p>I'm trying to set up a simple database for an online shopping webpage. But there are problems with my database.</p>
  
  <p>So in my ERD diagram where I've linked my category table to my main_course table as each main course will have a category like Japanese food or Italian food etc. </p>
  
  <p>I've exported my sql from this ERD to my database but when i insert a record it shows me this:</p>
  
  <p><strong>#1452 - Cannot add or update a child row: a foreign key constraint fails (<code>fyp</code>.<code>main_course</code>, CONSTRAINT <code>fk_main_course_category1</code> FOREIGN KEY (<code>category_id</code>) REFERENCES <code>category</code> (<code>category_id</code>) ON DELETE NO ACTION ON UPDATE NO ACTION)</strong></p>
  
  <p>I can't seem to figure out. Anybody help?</p>