title: Mysql: Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails
body: <p>I have this table:</p>
  
  <pre><code>CREATE TABLE comments(
      comment_id int(11) NOT NULL auto_increment,
      user_id int(11) NOT NULL,
      product_id int(11) NOT NULL,
      comment_text varchar(1000) COLLATE utf8_czech_ci NOT NULL,
      uploaded datetime NOT NULL,
      primary key(comment_id),
      constraint fk_user_comments foreign key(user_id) references user(user_id) ON UPDATE CASCADE ON DELETE CASCADE,
      constraint fk_product_comments foreign key(product_id) references product(product_id) ON UPDATE CASCADE ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
  </code></pre>
  
  <p>and I'm trying to insert data into this table.</p>
  
  <pre><code>INSERT INTO comments(user_id,product_id,comment_text,uploaded) VALUES(1,'brbr',1,Now());
  </code></pre>
  
  <p>But for some reason I keep getting this error:</p>
  
  <pre><code>Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`project`.`comments`, CONSTRAINT `fk_product_comments` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE)
  </code></pre>
  
  <p>User with id 1 exists and product with id 1 exists so now i have no idea whats causing the problem.</p>